Accounts

/accounts

GET Retrieve a list of accounts

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

Example Request:

curl --location --request GET "{{base_url}}/v1/accounts?page%5Blimit%5D&page%5Boffset%5D&sort&filter%5Bname%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[name]

Filter results by this attribute

include

Include additional related resources. Possible values: report, parent, children, rates, adjustments, users, metadata.

POST Add a new account

{{base_url}}/v1/accounts

Example Request:

curl --location --request POST "{{base_url}}/v1/accounts" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"data\": {
\"type\": \"account\",
\"attributes\": {
\"name\": \"My new account\"
},
\"relationships\": {
\"report\": {
\"data\": {
\"type\": \"report\",
\"id\": \"1\"
}
},
\"parent\": {
\"data\": {
\"type\": \"account\",
\"id\": \"50\"
}
}
}
}
}"
Example Response:

{
"data": {
"type": "account",
"id": "51",
"attributes": {
"name": "My new account",
"level": "2",
"lvl1_key": "My new account",
"lvl2_key": "My new account",
"lvl3_key": "",
"lvl4_key": "",
"lvl5_key": ""
},
"links": {
"self": "https://localhost:8012/v1/accounts/51"
}
}
}

HEADERS

Content-Type

application/json

Accept

application/vnd.api+json

BODY (raw)

{
"data": {
"type": "account",
"attributes": {
"name": "My new account"
},
"relationships": {
"report": {
"data": {
"type": "report",
"id": "1"
}
}
}
}
}

GET Retrieve an account

{{base_url}}/v1/accounts/{{account_id}}/?include

Example Request:

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

HEADERS

Accept

application/vnd.api+json

PARAMS

Include

Include additional related resources. Possible values: report, parent, children, rates, adjustments, users.

PATCH Update an account

{{base_url}}/v1/accounts/{{account_id}}

Example Request:

curl --location --request PATCH "{{base_url}}/v1/accounts/{{account_id}}" \
--header "Content-Type: application/json" \
--header "Accept: application/vnd.api+json" \
--data "{
\"data\": {
\"type\": \"account\",
\"id\": \"{{account_id}}\",
\"attributes\": {
\"name\": \"My new account name\"
}
}
}"

HEADERS

Content-Type

application/json

Accept

application/vnd.api+json

BODY (raw)
{
"data": {
"type": "account",
"id": "{{account_id}}",
"attributes": {
"name": "My new account name"
}
}
}

DEL Delete an account

{{base_url}}/v1/accounts/:accountId

Example Request:

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

HEADERS

Accept

application/json

PATH VARIABLES

accountId

{{account_id}}

BODY

(formdata)


How did we do?