Skip to main content
Skip table of contents

Updating a tree element

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

When the key is changed, the tree element does not lose dependencies that were created through the old key.

The tree element can be updated by id or by external_id.

PATCH/api/v1/billing/tree

Headers

Accept

application/json

Body

json

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

namerequired

string

Tree element name

idrequired

int

Tree element ID to be updated

external_idrequired

string|int

Key for tree element

typerequired

string

The type of tree within which the update occurs

new_external_idrequired

string|int

New unique own key for tree element

Response

200

Successful response

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

Returns a JSON object with an error. Validation

JSON
{
    "message": "There will be no informative message here",
    "errors": {
        "any_key": [
            "The reason for the error will be described here."
        ]
    }
}

Example

JSON
curl -k --location --request PATCH 'https://vms.local/api/v1/billing/tree' \
--header 'Accept:application/json' \
--header 'Content-Type: application/json \
--data-raw '{
    "name": "new name",
    "type": "cameras|intercoms",
    "id": null,
    "external_id": "current_value",
    "new_external_id": "new_value"
}'
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.