Search Objects

POST /node/api/objects/search

Searches for objects matching specified criteria.
Permissions: objectPermissions.

Request parameters

Body parameters

...

Response description

Field
Type
Description
objects
Array<Object>
An array of objects that match the specified search criteria.

Examples

Request examples

The following examples show how to perform a case-insensitive search of all objects named "CPU":
Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
url=https://$saymon_hostname/node/api/objects/search
5
6
curl -X POST $url -u $login:$password \
7
-H "Content-Type: application/json" \
8
-d @- <<EOF
9
{
10
"search": {
11
"name": {
12
"$regex": "cpu",
13
"$options": "i"
14
}
15
}
16
}
17
EOF
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let path = "/node/api/objects/search";
5
let auth = "Basic " + btoa(login + ":" + password);
6
7
let headers = new Headers();
8
headers.append("Content-Type", "application/json");
9
headers.append("Authorization", auth);
10
11
let data = JSON.stringify({
12
"search": {
13
"name": {
14
"$regex": "cpu",
15
"$options": "i"
16
}
17
}
18
});
19
20
let requestOptions = {
21
method: "POST",
22
headers: headers,
23
body: data
24
};
25
26
fetch(saymonHostname + path, requestOptions)
27
.then(response => response.text())
28
.then(result => console.log(result))
29
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let path = "/node/api/objects/search";
7
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
8
9
let options = {
10
"method": "POST",
11
"hostname": saymonHostname,
12
"headers": {
13
"Authorization": auth,
14
"Content-Type": "application/json"
15
},
16
"path": path
17
};
18
19
let req = http.request(options, function (res) {
20
let chunks = [];
21
22
res.on("data", function (chunk) {
23
chunks.push(chunk);
24
});
25
26
res.on("end", function (chunk) {
27
let body = Buffer.concat(chunks);
28
console.log(body.toString());
29
});
30
31
res.on("error", function (error) {
32
console.error(error);
33
});
34
});
35
36
let data = JSON.stringify({
37
"search": {
38
"name": {
39
"$regex": "cpu",
40
"$options": "i"
41
}
42
}
43
});
44
45
req.write(data);
46
req.end();
Copied!
1
import requests
2
import json
3
4
login = <...>
5
password = <...>
6
saymon_hostname = <...>
7
url = "https://" + saymon_hostname + "/node/api/objects/search"
8
9
body = {
10
"search": {
11
"name": {
12
"$regex": "cpu",
13
"$options": "i"
14
}
15
}
16
}
17
18
response = requests.request("POST", url, json=body, auth=(login, password))
19
print(response.text)
Copied!

Response example

1
[
2
{
3
"name": "CPU",
4
"discovery_id": "192.168.1.82-CPU",
5
"object_groups": [],
6
"geoposition": [],
7
"child_ref_ids": [],
8
"child_link_ids": [],
9
"child_ids": [],
10
"parent_id": "5e21b85b308c3c66d64e07bc",
11
"weight": 1,
12
"tags": [],
13
"last_state_update": 1583141090805,
14
"updated": 1583916836283,
15
"created": 1579268187099,
16
"state_id": 7,
17
"class_id": 4,
18
"operations": [
19
...
20
],
21
"properties": [
22
{
23
"name": "AgentId",
24
"value": "5e21b85b308c3c66d64e07c8",
25
"type_id": 8,
26
"id": "5e21b85b308c3c66d64e07d5"
27
},
28
...
29
],
30
"manual_state": null,
31
"owner_id": "5e21b752308c3c66d64e072c",
32
"id": "5e21b85b308c3c66d64e07d2"
33
},
34
...
35
]
Copied!
Last modified 1yr ago