Breadcrumbs

Retrieve a tree structure

The method and parameters

GET  /api/v1/billing/tree

When a tree is queried, the root elements are returned by default.

The identifier can be id or external_id.

string type – a type of tree to retrieve.


int id – the ID of the tree element which subelements are to be retrieved.


string|int external_id – the unique key of the tree element whose sub-elements you want to retrieve.

200  OK

Successful response

JSON
[
    {
        "id": 14,
        "name": "Name of item 1",
        "external_id": "unique_key_1",
        "has_items": true
    },
    {
        "id": 15,
        "name": "Name of item 2",
        "external_id": "unique_key_2",
        "has_items": false
    },
    {
        "id": 16,
        "name": "Name of item 3",
        "external_id": null,
        "has_items": false
    }
]

422  Unprocessable Entity

Returns a JSON object with an error. For details, see General information > Validation.

JSON
{
    "message": "No error message here",
    "errors": {
        "any_key": [
            "Error details"
        ]
    }
}
cURL
Bash
curl -k --request GET \
	--url 'https://your-domain/api/v1/billing/tree' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "type": "string",
    "id": 0,
    "external_id": "string|int"
}'
PHP
PHP
$data = array (
  'type' => 'string',
  'id' => 0,
  'external_id' => 'string|int',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'GET',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/v1/billing/tree', false, $context);