Breadcrumbs

Update a tree element

The method and parameters

PATCH  /api/v1/billing/tree

When updating a tree element, you can rename it or change its key.

Changing the key of a tree element doesn’t remove any dependencies established using the old key.

A tree element can be updated by either its id or its external_id.

JSON
{
    "name": "new name",
    "type": "cameras|intercoms",
    "id": null,
    "external_id": "current_value",
    "new_external_id": "new_value",
    "log_extra": {
        "some": "information"
    }
}

string name, Name of the tree element


int id, ID of the tree element to update


string|int external_id, Key for tree element


string type, Type of tree within which the update occurs


string|int new_external_id, New unique private key for the tree element


string|array log_extra, Additional information received from an external system

200  OK

Successful response

JSON
{
    "id": 15,
    "name": "Name of item",
    "external_id": "unique_key",
    "has_items": true
}

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 PATCH \
	--url 'https://your-domain/api/v1/billing/tree' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "name": "string",
    "id": 0,
    "external_id": "string|int",
    "type": "string",
    "new_external_id": "string|int",
    "log_extra": "string|array"
}'
PHP
PHP
$data = array (
  'name' => 'string',
  'id' => 0,
  'external_id' => 'string|int',
  'type' => 'string',
  'new_external_id' => 'string|int',
  'log_extra' => 'string|array',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'PATCH',
		'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);