Skip to content

Budget routes: update, delete

The Budget Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for Budget, one group of Budget routes.

Budget.update

Changes the given properties of a Budget. Verb page.

Text
PATCH /{namespace}/budgets/{id}

Path: id. Body, as JSON: the other inputs. Emits Budget.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Budget.
accountstringThe chart-of-accounts code it plans, such as expense.ads.
periodPeriodThe Period it plans.
amountmoneyThe amount set for the account in the Period.

Returns

OutputTypeRequiredDescription
budgetBudgetrequiredThe Budget.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X PATCH https://api.sb/leaseline.app/budgets/budget_qnCdsFGLVN \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"account":"expense.ads"}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "budget": {
    "$id": "https://api.sb/leaseline.app/budgets/budget_qnCdsFGLVN",
    "$type": "Budget",
    "account": "expense.ads",
    "period": "period_VEVuYACTsH",
    "amount": {
      "amount": 29,
      "currency": "USD"
    }
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Budget.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Budget.delete

Deletes a Budget: a soft delete that keeps its history, undone by Thing.restore. Verb page.

Text
DELETE /{namespace}/budgets/{id}

Path: id. Emits Budget.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Budget.

Returns

OutputTypeRequiredDescription
budgetBudgetrequiredThe Budget.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X DELETE https://api.sb/leaseline.app/budgets/budget_qnCdsFGLVN \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "budget": {
    "$id": "https://api.sb/leaseline.app/budgets/budget_qnCdsFGLVN",
    "$type": "Budget",
    "account": "expense.ads",
    "period": "period_VEVuYACTsH",
    "amount": {
      "amount": 29,
      "currency": "USD"
    }
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Budget.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}