Update budget
Update a budget. Some related data is updated asynchronously. Clients can set an additional query parameter update which dictates which budgets to update. Possible values are:
| all | Updates are to effect all past and future budgets. |
| one | Updates only the current budget. |
| tail | Updates will be in effect from now on. |
If update parameter is not specified the default value is all.
Note: Certain circumstances will cause all changes made to past or future budgets to be lost.
PUT /budgets/{id}
Required scope:
- budgets:rw
Parameters
|
id * required string
|
Budget id. |
|
name * required string
|
Budget name. Max length:255 |
|
limit * required number
|
Budget limit. If > -1000000000000000Maximum: < 1000000000000000 |
|
currency * required object
|
Currency object |
|
code * required string
|
Budget currency code. Regex:[A-Z0-9_]{2,10} |
|
rate optional number
|
Budget exchange rate calculated according to users currency. If not set (and currency differs from main currency) the daily exchange rate will be used. Minimum:> 0 |
|
main_rate optional number
|
Entry exchange rate main currency calculated according to entry main currency. |
|
fixed optional boolean
|
If set to true, the exchange rate is not refreshed on next budget iteration. Default value:false |
|
rollover optional boolean
|
Boolean which determines if rollover is enabled for budget. If rollover is enabled whatever is left of the budget |
|
rollover_amount optional number
|
Current budget rollover amount if rollover is > -1000000000000000Maximum: < 1000000000000000Default value: 0 |
|
rollover_override optional boolean
|
Is true if rollover is overriden with a custom amount (can be useful for smart clients). |
|
modified * required string
|
Specifies when the budget was last modified. |
|
type * required string
|
Budget type. Possible values:regular, delta, percent |
|
percent optional number
|
Percent of monthly income. If > 0 |
|
delta optional number
|
Used to define monthly budget -/+ delta. If |
|
tags optional array
|
An |
|
!tags optional array
|
An |
|
categories optional array
|
An |
|
!categories optional array
|
An |
|
accounts optional array
|
An |
|
!accounts optional array
|
An |
|
extra optional object
|
A custom JSON object that you can use to extend Toshl API. Whatever you save into this field you will get back whenever you fetch it later. |
* denotes required field/parameter.
Request
$ curl https://api.toshl.com/budgets/42 \
-H "Authorization: Bearer T9cE5asGnuyYCCqIZFoWjFHvNbvVqHjl" \
-H "Content-Type: application/json" \
-X PUT \
-d '{json}'
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "42",
"name": "Monthly budget",
"limit": 1000,
"amount": 78.4,
"planned": 12.6,
"currency": {
"code": "USD",
"rate": 1,
"fixed": false
},
"from": "2013-02-01",
"to": "2013-02-30",
"rollover": false,
"modified": "2013-06-27T14:14:03+00:00Z",
"recurrence": {
"frequency": "monthly",
"interval": 1,
"start": "2012-06-01",
"iteration": 4
},
"status": "active",
"type": "regular",
"order": 0,
"categories": ["42"]
}