Budgets

/budgets

POST Add a new budget

{{base_url}}/v1/budgets

Example Request:

curl --location --request POST "{{base_url}}/v1/budgets" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"data\": {
\"type\": \"budget\",
\"attributes\": {
\"interval\": \"year\",
\"description\": \"This is a new budget\",
\"metric\": \"cogs\"
},
\"relationships\": {
\"report\": {
\"data\": {
\"type\": \"report\",
\"id\" : {{report_id}}
}
}
}
}
}"

HEADERS

Content-Type

application/json

Accept

application/vnd.api+json

BODY (raw)

{
"data": {
"type": "budget",
"attributes": {
"interval": "year",
"description": "This is a new budget",
"metric": "cogs"
},
"relationships": {
"report": {
"data": {
"type": "report",
"id" : {{report_id}}
}
}
}
}
}

GET Retrieve a list of budgets

{{base_url}}/v1/budgets?page[limit]&page[offset]&sort&filter[attribute]&include=

Example Request:

curl --location --request GET "{{base_url}}/v1/budgets?page%5Blimit%5D&page%5Boffset%5D&sort&filter%5Battribute%5D&include=" \
--header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PARAMS

page[limit]

Limit the amount of results returned

page[offset]

Return this page of the results

sort

Sort results by this attribute

filter[attribute]

Filter results by this attribute

include

Include additional related resources. Possible values: revisions.

GET Retrieve a budget

{{base_url}}/v1/budgets/:budget_id?include=

Test description

Example Request:

curl --location --request GET "{{base_url}}/v1/budgets/:budget_id?include=" \
            --header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PARAMS

include

Include additional related resources: revisions

PATH VARIABLES

budget

{{budget_id}}

PATCH Update a budget

{{base_url}}/v1/budgets/:budget_id

Test description

Example Request:

curl --location --request PATCH "{{base_url}}/v1/budgets/:budget_id" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"data\": {
\"type\": \"budget\",
\"id\": \"{{budget_id}}\",
\"attributes\": {
\"description\": \"modified_test\",
\"interval\": \"year\",
\"metric\": \"cogs\"
}
}
}"

HEADERS

Content-Type

application/json

Accept

application/vnd.api+json

PATH VARIABLES

budget_id

{{budget_id}}

BODY (raw)
{
"data": {
"type": "budget",
"id": "{{budget_id}}",
"attributes": {
"description": "modified_test",
"interval": "year",
"metric": "cogs"
}
}
}

DEL Delete a budget

{{base_url}}/v1/budgets/:budget_id

Example Request:

curl --location --request DELETE "{{base_url}}/v1/budgets/:budget_id" \
--header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PATH VARIABLES

budget_id

{{budget_id}}

BODY (formdata)

GET Run a budget

{{base_url}}/v1/budgets/:budget_id/run?start={{start}}&end={{end}}

Test description

Example Request:

curl --location --request GET "{{base_url}}/v1/budgets/:budget_id/run?start={{start}}&end={{end}}" \
            --header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PARAMS

start

{{start}}

end

{{end}}

PATH VARIABLES

budget_id

{{budget_id}}


/budgetrevisions

POST Add a new budget revision

{{base_url}}/v1/budgetrevisions

Example Request:

curl --location --request POST "{{base_url}}/v1/budgetrevisions" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"data\": {
\"type\":\"budgetrevision\",
\"attributes\": {
\"effective_from\": \"20190606\"
},
\"relationships\": {
\"budget\": {
\"data\": {
\"type\": \"budget\",
\"id\": \"{{budget_id}}\"
}
}
}
}
}"

HEADERS

Content-Type

application/json

Accept

application/vnd.api+json

BODY (raw)

{
"data": {
"type":"budgetrevision",
"attributes": {
"effective_from": "20190606"
},
"relationships": {
"budget": {
"data": {
"type": "budget",
"id": "{{budget_id}}"
}
}
}
}
}

GET Retrieve a list of budget revisions

{{base_url}}/v1/budgetrevisions?page[limit]&page[offset]&sort&filter[attribute]&include=

Example Request:

url --location --request GET "{{base_url}}/v1/budgetrevisions?page%5Blimit%5D&page%5Boffset%5D&sort&filter%5Battribute%5D&include=" \
--header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PARAMS

page[limit]

Limit the amount of results returned

page[offset]

Return this page of the results

sort

Sort results by this attribute

filter[attribute]

Filter results by this attribute

include

Include additional related resources. Possible values: budget, items

GET Retrieve a budget revision

{{base_url}}/v1/budgetrevisions?page[limit]&page[offset]&sort&filter[attribute]&include=

Example Request:

curl --location --request GET "{{base_url}}/v1/budgetrevisions/:revision_id?include=" \
--header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PARAMS

include

Include additional related resources. Possible values: budget, items

PATH VARIABLES

revision_id

{{budgetrevision_id}}

GET Validate a budget revision

{{base_url}}/v1/budgetrevisions/:revision_id/validate

Test description

Example Request:

curl --location --request GET "{{base_url}}/v1/budgetrevisions/:revision_id/validate" \
            --header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PATH VARIABLES

revision_id

{{budgetrevision_id}}

PATCH Update a budget revision

{{base_url}}/v1/budgetrevisions/:budget_revision_id

Example Request:

curl --location --request PATCH "{{base_url}}/v1/budgetrevisions/:budget_revision_id" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"data\": {
\"type\":\"budgetrevision\",
\"id\":{{budgetrevision_id}},
\"attributes\": {
\"effective_from\": \"20190808\"
}
}
}"

HEADERS

Content-Type

application/json

Accept

application/vnd.api+jsonn

PATH VARIABLES

budget_revision_id

{{budgetrevision_id}}

BODY (raw)
{
"data": {
"type":"budgetrevision",
"id":{{budgetrevision_id}},
"attributes": {
"effective_from": "20190808"
}
}
}

DEL Delete a budget revision

{{base_url}}/v1/budgetrevisions/:budget_revision_id

Example Request:

curl --location --request DELETE "{{base_url}}/v1/budgetrevisions/:budget_revision_id" \
--header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PATH VARIABLES

budget_revision_id

{{budgetrevision_id}}

BODY

(formdata)


/budgetitems

POST Add a new budget item

{{base_url}}/v1/budgetitems

Example Request:

curl --location --request POST "{{base_url}}/v1/budgetitems" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"data\": {
\"type\":\"budgetitem\",
\"attributes\": {
\"kind\": \"account\",
\"status\": \"regular\",
\"percent\": false,
\"distribution\": \"even\",
\"filter\": \"none\"
},
\"relationships\": {
\"revision\": {
\"data\": {
\"type\": \"budgetrevision\",
\"id\": \"{{budgetrevision_id}}\"
}
},
\"account\": {
\"data\": {
\"type\": \"account\",
\"id\": \"{{account_id}}\"
}
},
\"parent\": {
\"data\": {
\"type\": \"item\",
\"id\": \"{{budgetitem_id}}\"
}
}
}
}
}"

Example Response:

{
"data": { "type": "budgetitem",
"id": "6",
"attributes": {
"kind": "account",
"status": "regular",
"filter": "none",
"amount": null,
"percent": false,
"distribution": "even"
},
"links": {
"self": "https://localhost:8012/v1/budgetitems/6"
}
}
}

HEADERS

Content-Type

application/json

Accept

application/vnd.api+json

BODY (raw)

{
"data": {
"type":"budgetitem",
"attributes": {
"kind": "account",
"status": "regular",
"percent": false,
"distribution": "even",
"filter": "none"
},
"relationships": {
"revision": {
"data": {
"type": "budgetrevision",
"id": "{{budgetrevision_id}}"
}
},
"account": {
"data": {
"type": "account",
"id": "{{account_id}}"
}
}
}
}
}

GET Retrieve a list of budget items

{{base_url}}/v1/budgetitems?page[limit]&page[offset]&sort&filter[attribute]&include=

Example Request:

curl --location --request GET "{{base_url}}/v1/budgetitems?page%5Blimit%5D&page%5Boffset%5D&sort&filter%5Battribute%5D&include=" \
--header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PARAMS

page[limit]

Limit the amount of results returned

page[offset]

Return this page of the results

sort

Sort results by this attribute

filter[attribute]

Filter results by this attribute

include

Include additional related resources. Possible values: revision, parent, children, account, services, servicecategories

GET Retrieve a budget item

{{base_url}}/v1/budgetitems/:item_id?include=

Test description

Example Request:

curl --location --request GET "{{base_url}}/v1/budgetitems/:item_id?include=" \
--header "Accept: application/vnd.api+json"

HEADERS

Accept

application/vnd.api+json

PARAMS

include

Include additional related resources. Possible values: revision, parent, children, account, services, servicecategories

PATH VARIABLES

item_id

{{budgetitem_id}}

PATCH Update a budget item

{{base_url}}/v1/budgetitems/:budgetitem_id

Example Request:

curl --location --request PATCH "{{base_url}}/v1/budgetitems/:budgetitem_id" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"data\": {
\"type\":\"budgetitem\",
\"id\":{{budgetitem_id}},
\"attributes\": {
\"amount\": 100
}
}
}"

HEADERS

Content-Type

application/json

Accept

application/vnd.api+json

PATH VARIABLES

budgetitem_id

{{budgetitem_id}}

BODY (raw)
{
"data": {
"type":"budgetitem",
"id":{{budgetitem_id}},
"attributes": {
"amount": 100
}
}
}

DEL Delete a budget item

{{base_url}}/v1/budgetitems/:budgetitem_id
          

Example Request:

curl --location --request DELETE "{{base_url}}/v1/budgetitems/:budgetitem_id" \
            --header "Accept: application/json"

HEADERS

Accept

application/json

PATH VARIABLES

budgetitem_id

{{budgetitem_id}}

BODY (formdata)

PATCH Patch budget items (add, create, delete)

{{base_url}}/v1/budgetitems

Example Request:

curl --location --request PATCH "{{base_url}}/v1/budgetitems" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"operations\": [
{
\"op\": \"add\",
\"data\": {
\"type\":\"budgetitem\",
\"attributes\": {
\"kind\": \"account\",
\"status\": \"regular\",
\"percent\": 0,
\"distribution\": \"even\",
\"filter\": \"none\"
},
\"relationships\": {
\"revision\": {
\"data\": {
\"type\": \"budgetrevision\",
\"id\": \"{{budgetrevision_id}}\"
}
},
\"account\": {
\"data\": {
\"type\": \"account\",
\"id\": \"{{account_id}}\"
}
}
}
}
},
{
\"op\": \"delete\",
\"data\": {
\"type\": \"budgetitem\",
\"id\": \"{{item_id}}\"
}
},
{
\"op\":\"update\",
\"data\": {
\"type\": \"budgetitem\",
\"attributes\": {
\"kind\": \"service\"
}
}
}
]
}
" }
}"

HEADERS

Content-Type

application/json

Accept

application/vnd.api+json

BODY (raw)
{
"operations": [
{
"op": "add",
"data": {
"type":"budgetitem",
"attributes": {
"kind": "account",
"status": "regular",
"percent": 0,
"distribution": "even",
"filter": "none"
},
"relationships": {
"revision": {
"data": {
"type": "budgetrevision",
"id": "{{budgetrevision_id}}"
}
},
"account": {
"data": {
"type": "account",
"id": "{{account_id}}"
}
}
}
}
},
{
"op": "delete",
"data": {
"type": "budgetitem",
"id": "{{item_id}}"
}
},
{
"op":"update",
"data": {
"type": "budgetitem",
"attributes": {
"kind": "service"
}
}
}
]
}

How did we do?