Получить дочерние объекты сущности

Возвращает все дочение объекты указанной сущности (включая связи и ссылки).

Запрос

HTTP Запрос

GET /node/api/entities/:id/children

Права

entityPermissions

Параметры пути

Параметр Тип Описание

id

String

ID сущности, чьи дочерние объекты должен вернуть запрос.

Параметры запроса

Параметр Тип Описание

skip-refs

Boolean

Если true, то запрос не будет включать ссылки.

Тело запроса

Тело запроса пустое.

Ответ

Возвращает дочерние объекты сущности. Подробная информация о моделей доступна в статьях Объект и Связь.

Примеры

Запрос

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
entity_id=<...>
url=https://$saymon_hostname/node/api/entities/$entity_id/children

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let entityId = <...>
let path = "/node/api/entities/" + entityId + "/children";
let auth = "Basic " + btoa(login + ":" + password);

let headers = new Headers();
headers.append("Authorization", auth);

let requestOptions = {
    method: "GET",
    headers: headers
};

fetch(saymonHostname + path, requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log("error", error));
const http = require("http");

let login = <...>
let password = <...>
let saymonHostname = <...>
let entityId = <...>
let path = "/node/api/entities/" + entityId + "children";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    "method": "GET",
    "hostname": saymonHostname,
    "headers": {
        "Authorization": auth
    },
    "path": path
};

let req = http.request(options, function (res) {
    let chunks = [];

    res.on("data", function (chunk) {
        chunks.push(chunk);
    });

    res.on("end", function (chunk) {
        let body = Buffer.concat(chunks);
        console.log(body.toString());
    });

    res.on("error", function (error) {
        console.error(error);
    });
});

req.end();
import requests

login = <...>
password = <...>
saymon_hostname = <...>
entity_id = <...>
url = "https://" + saymon_hostname + "/node/api/entities/" + entity_id + "/children"

response = requests.request("GET", url, auth=(login, password))
print(response.text)

Ответ

[
    {
        "id": "64d0f60a88d2b74344bac9e2",
        "parent_id": [
            "64c7b89ea60ace53579cbdf8"
        ],
        "client_data": "{\"headlinePropIds\":[],\"custom_style\":{\"zIndex\":10,\"left\":\"275px\",\"top\":\"265px\",\"width\":\"300px\",\"height\":\"200px\"}}",
        "object_groups": [],
        "name": "API Demo 1",
        "class_id": "64c7b6eda60ace53579cbda9",
        "geoposition": [],
        "geopositionRadius": 0,
        "tags": [],
        "operations": [],
        "properties": [
            {
                "type_id": 1,
                "name": "test",
                "value": "default",
                "id": "64d0f60a88d2b74344bac9e1"
            }
        ],
        "owner_id": "62c2f3ce80c8654892764d56",
        "updated": 1691416105431,
        "state_id": 1,
        "created": 1691416074506,
        "last_state_update": 1691416074506,
        "weight": 1,
        "child_ids": [],
        "child_link_ids": [],
        "child_ref_ids": [],
        "_stateConditionRefs": [],
        "entityType": 1
    },
    {
        "id": "64d0f61588d2b74344bac9ea",
        "parent_id": [
            "64c7b89ea60ace53579cbdf8"
        ],
        "client_data": "{\"headlinePropIds\":[],\"custom_style\":{\"zIndex\":15,\"left\":\"705px\",\"top\":\"266px\",\"width\":\"300px\",\"height\":\"200px\"}}",
        "object_groups": [],
        "name": "API Demo 2",
        "class_id": "64c7b6eda60ace53579cbda9",
        "geoposition": [],
        "geopositionRadius": 0,
        "tags": [],
        "operations": [],
        "properties": [
            {
                "type_id": 1,
                "name": "test",
                "value": "default",
                "id": "64d0f61588d2b74344bac9e9"
            }
        ],
        "owner_id": "62c2f3ce80c8654892764d56",
        "updated": 1701976811207,
        "state_id": 1,
        "created": 1691416085488,
        "last_state_update": 1691416085488,
        "weight": 1,
        "child_ids": [],
        "child_link_ids": [],
        "child_ref_ids": [],
        "_stateConditionRefs": [],
        "entityType": 1
    },
    {
        "id": "65721ae8286b2d3e41572879",
        "source": "64d0f60a88d2b74344bac9e2",
        "target": "64d0f61588d2b74344bac9ea",
        "state_id": 1,
        "client_data": "{\"headlinePropIds\":[]}",
        "tags": [],
        "operations": [],
        "owner_id": "62c2f3ce80c8654892764d56",
        "updated": 1701976808071,
        "target_name": "API Demo 2",
        "source_name": "API Demo 1",
        "name": "API Demo 1 - API Demo 2",
        "properties": [],
        "class_id": 35,
        "created": 1701976808074,
        "last_state_update": 1701976808074,
        "weight": 1,
        "entityType": 2
    }
]

Смотрите также