Получить список дочерних связей

Получает список связей между дочерними объектами заданного объекта.

Запрос

HTTP Запрос

GET /node/api/objects/:id/children/links

Права

objectPermissions

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

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

id

String
обязательный

ID или discovery ID объекта.

Тело запроса

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

Ответ

Поле Тип Описание

children_links

Array<Link>

Массив дочерних связей объекта.

Пример

Запрос

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
object_id=<...>
url=https://$saymon_hostname/node/api/objects/$object_id/children/links

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let objectId = <...>
let path = "/node/api/objects/" + objectId + "/children/links";
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 objectId = <...>
let path = "/node/api/objects/" + objectId + "/children/links";
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 = <...>
object_id = <...>
url = "https://" + saymon_hostname + "/node/api/objects/" + \
    object_id + "/children/links"

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

Ответ

[
    {
        "source": "5e85e026a82a7421a9a3499b",
        "target": "5e85e0c8a82a7421a9a349a8",
        "client_data": "{\"headlinePropIds\":[]}",
        "owner_id": "5e1f04e753e27e5dfa554120",
        "weight": 1,
        "tags": [],
        "last_state_update": 1585914352499,
        "updated": 1585914352498,
        "created": 1585914352499,
        "state_id": 1,
        "class_id": 35,
        "_stateConditionRefs": [],
        "operations": [],
        "properties": [],
        "id": "5e8721f0a82a7421a9a35204"
    },
    {
        "source": "5e85e0c8a82a7421a9a349a8",
        "target": "5e860968a82a7421a9a34a88",
        "client_data": "{\"headlinePropIds\":[]}",
        "owner_id": "5e1f04e753e27e5dfa554120",
        "weight": 1,
        "tags": [],
        "last_state_update": 1585914355862,
        "updated": 1585914355861,
        "created": 1585914355862,
        "state_id": 1,
        "class_id": 35,
        "_stateConditionRefs": [],
        "operations": [],
        "properties": [],
        "id": "5e8721f3a82a7421a9a3520f"
    }
]

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