Get Entity by ID

Returns a JSON representation of the object or link with the specified ID.

Request

HTTP Request

GET /node/api/entities/:id

Permissions

entityPermissions

Path parameters

Parameter Type Description

id

String
required

The ID of the entity to be retrieved.

Query parameters

Parameter Type Description

fields

Array<String>

Comma-separated names of Entity fields to return.

Request body

The request body is empty.

Response

Returns the requested entity. See the Object model or Link model for a list of all returned fields depending on the entity type.

Example

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

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

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let entityId = <...>
let path = "/node/api/entities/" + entityId;
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;
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

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

Response

{
    "id": "64c7b89ea60ace53579cbdf8",
    "parent_id": [
        "62d7e58056d203149a08001b"
    ],
    "client_data": "{\"headlinePropIds\":[],\"custom_style\":{\"zIndex\":137,\"left\":\"138px\",\"top\":\"1631px\",\"width\":\"300px\",\"height\":\"200px\"}}",
    "object_groups": [],
    "name": "API Demo",
    "class_id": "64c7b6eda60ace53579cbda9",
    "geoposition": [],
    "geopositionRadius": 0,
    "tags": [],
    "operations": [],
    "owner_id": "62c2f3ce80c8654892764d56",
    "updated": 1691413208404,
    "properties": [
        {
            "type_id": 1,
            "name": "test-2",
            "value": "value",
            "id": "64c7b8e2a60ace53579cbe0d"
        }
    ],
    "state_id": 1,
    "created": 1690810526488,
    "last_state_update": 1690810526488,
    "weight": 1,
    "child_ids": [
        "64d0f60a88d2b74344bac9e2",
        "64d0f61588d2b74344bac9ea"
    ],
    "child_link_ids": [
        "65721ae8286b2d3e41572879"
    ],
    "child_ref_ids": [
        "65721d2a286b2d3e41572884"
    ],
    "_stateConditionRefs": [],
    "entityType": 1
}