Skip to content

Get Link's Parent Paths

Get hierarchy path from the source object of the specified link to the root object.

Request

HTTP Request

GET /node/api/links/:id/paths

Permissions

linkPermissions

Path parameters

Parameter Type Description
id String ID of the link which paths to retrieve.

Query parameters

Parameter Type Description
fields String Comma-separated list of parent objects' fields to return.

Request body

The request body is empty.

Response

Response contains two lists – paths and objects.

paths contains IDs of every parent object (including the root object) and the ID of the requested link's source object. The first element in the list is the link's source object, the last is the root object.

objects list contains information about each object in the path. You can select returned fields with the fields query parameter. You can see the list of all possible fields in the Object model article.

By default, each objects includes the following fields:

Field Type Description
id String Object's ID.
name String Object's name.
class_id String The ID of an object class.
child_ids Array<String> An array of object's child objects IDs.
child_link_ids Array<String> An array of object's child links IDs.
child_ref_ids Array<String> An array of object's child references IDs.
parent_id Array<String> The IDs of an object's parents.
geoposition Array<Float> Object's position on a map. It's specified as an array of two float numbers, where the first number is longitude, the second one is latitude.
geopositionRadius Integer The radius of an object's area displayed on a map.
state_id String The ID of an object state.
last_state_update Integer A timestamp when object's state was last updated.

Examples

Request

login=<...>
password=<...>
saymon_hostname=<...>
link_id=<...>
url=https://$saymon_hostname/node/api/links/$link_id/paths

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let linkId = <...>
let path = "/node/api/links/" + linkId + "/paths";
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 linkId = <...>
let path = "/node/api/links/" + linkId + "/paths";
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 = <...>
link_id = <...>
url = "https://" + saymon_hostname + "/node/api/links/" + link_id + "/paths"

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

Response

{
  "paths": [
    [
      "601bfe12bcf92174b22ce4f2",
      "601bfdf804ab1a73eda8f1f8",
      1
    ]
  ],
  "objects": [
    {
      "name": "test",
      "state_id": 9,
      "id": "601bfe12bcf92174b22ce4f2"
    },
    {
      "name": "alex-test_2",
      "state_id": 9,
      "id": "601bfdf804ab1a73eda8f1f8"
    },
    {
      "name": "Staging",
      "state_id": 5,
      "id": 1
    }
  ]
}