Get Object’s Children
Returns a list of object’s children.
Request
Path parameters
Parameter | Type | Description |
---|---|---|
id |
String |
The ID or discovery ID of the object whose children must be retrieved. |
Response
Field | Type | Description |
---|---|---|
children |
Array<__Object> |
An array of object’s children. |
Example
Request
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
saymon_hostname=<...>
object_id=<...>
url=https://$saymon_hostname/node/api/objects/$object_id/children
curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let objectId = <...>
let path = "/node/api/objects/" + objectId + "/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 objectId = <...>
let path = "/node/api/objects/" + objectId + "/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 = <...>
object_id = <...>
url = "https://" + saymon_hostname + "/node/api/objects/" + \
object_id + "/children"
response = requests.request("GET", url, auth=(login, password))
print(response.text)
Response
[
{
"name": "SAYMON Agent",
"object_groups": [],
"geoposition": [],
"child_ref_ids": [],
"child_link_ids": [],
"child_ids": [],
"parent_id": "5e21b85b308c3c66d64e07bc",
"weight": 1,
"tags": [],
"last_state_update": 1585034440816,
"updated": 1583915705723,
"created": 1579268187073,
"state_id": 3,
"class_id": 2,
"_stateConditionRefs": [],
"operations": [],
"properties": [],
"client_data": "...",
"id": "5e21b85b308c3c66d64e07c8"
},
{
"name": "CPU",
"discovery_id": "example-CPU",
"object_groups": [],
"geoposition": [],
"child_ref_ids": [],
"child_link_ids": [],
"child_ids": [],
"parent_id": "5e21b85b308c3c66d64e07bc",
"weight": 1,
"tags": [],
"last_state_update": 1583141090805,
"updated": 1583916836283,
"created": 1579268187099,
"state_id": 7,
"class_id": 4,
"_stateConditionRefs": [],
"operations": [],
"properties": [],
"client_data": "{...}",
"manual_state": null,
"owner_id": "5e21b752308c3c66d64e072c",
"id": "5e21b85b308c3c66d64e07d2"
},
...
}