Get All Classes
Returns a list of all existing classes.
Note
This request doesn't return all fields of classes. Check the Response section for more information.
Request
HTTP Request
Path parameters
No parameters required.
Request body
The request body is empty.
Response
Returns an array of all classes in the system. Uses the Class model.
This request doesn't return all fields of classes. It returns fields based on whether they were assigned.
The following fields are returned for a newly created class.
Field | Type | Description |
---|---|---|
id | String | Class's ID. |
name | String | Class's name. |
operations | Array<Operation> | An array of class's operations. |
client_data | String | Class's client data. |
The rest of class's fields are returned if they've been assigned a value. For example, if you add a property to a class, a list of properties will be included in the response.
However, even if you set the changed field to the default value (for example, delete all properties
or set the description
to an empty string), it would still be included in the response.
Example
Request
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/classes";
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 path = "/node/api/classes";
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();
Response
[
{
"name": "Root",
"operations": [],
"properties": [],
"description": "Root object",
"default_agent_task_definition": "",
"category_id": null,
"id": 1
},
{
"name": "Saymon Agent",
"operations": [],
"properties": [],
"description": "Saymon Agent",
"default_agent_task_definition": "",
"id": 2
},
{
"name": "Node",
"operations": [],
"default_agent_task_definition": "",
"category_id": 3,
"id": 13
},
...
]