API / Organization nodes

Nodes endpoint enables you to get organization node information and manage organization nodes in Silverbucket's database. Endpoint's URL is:

https://<your_environment_url>/customer-api/1.0/nodes/

GET


When calling /nodes/ endpoint without parameters you will get all the organization nodes from database. Example response:
{
    "count": 1,
    "csvUrl": "/customer-api/1.0/nodes/?csv=true",
    "itemsPerPage": 500,
    "excelUrl": "/customer-api/1.0/nodes/?excel=true",
    "next": null,
    "current": 1,
    "lastPage": 1,
    "data": [
        {
            "id": 1,
            "created": "2020-02-18T11:52:48.618982",
            "modified": "2020-02-18T11:52:48.618996",
            "name": "Organization 1",
            "code": "O1",
            "active": true,
            "lft": 1,
            "rght": 2,
            "tree_id": 1,
            "level": 0,
            "parent": null
        }
    ],
    "previous": null
}

POST


You can add organization nodes with POST method to the same URL than get. POST body contains new organization nodes data in JSON format. Successful call will give response code 201 and return the newly created organization nodes JSON. Minimum JSON for adding a node is:
{
    "name": "<string>",
}

PATCH


When you want to for example disable some organization node or change it's name you can use PATCH method. URL should contain the ID of the node you wish to modify:
https://<your_environment_url>/customer-api/1.0/nodes/<node_id>/
In message body you should deliver the edited fields: name, code, active, level or/and parent.
How did we do with this article?