Skip to main content
Skip table of contents

Creating a tree element

There are two types of tree, for cameras and for intercoms.

When creating elements, you can specify your own key, by which you can refer to this element. These keys must be unique within the same tree type.

When creating a subelement in the tree, you can send both the id from our database and the key that is specified during creation.

A tree element cannot contain subelements and leaf objects at the same time.

Once a tree root is created, it will be available to administrators who have access to Sync Tree Roots to User (groups-root-sync)

POST/api/v1/billing/tree

Headers

Accept

application/json

Body

json

JSON
{
    "name": "new name",
    "type": "cameras|intercoms",
    "external_id": null,
    "parent_external_id": null,
    "parent_id": null
}

namerequired

string

Tree element name

typerequired

string

tree type

external_idrequired

string|int

Key for tree element

parent_idrequired

int

Required to create a sub-element in the tree through id in our database

parent_external_idrequired

string|int

Required to create a sub-element in the tree through a unique key specified when it was created

Response

201

Successful response

JSON
{
                "id": 15,
                "name": "Name of item",
                "external_id": "unique_key",
                "has_items": false
            }
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 POST 'https://vms.local/api/v1/billing/tree' \
--header 'Accept:application/json' \
--header 'Content-Type: application/json \
--data-raw '{
    "name": "new name",
    "type": "cameras|intercoms",
    "external_id": null,
    "parent_external_id": null,
    "parent_id": null
}'
JavaScript errors detected

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

If this problem persists, please contact our support.