Get Class by ID

GET /node/api/classes/:id

Returns the class with the specified ID.

Request parameters

Path parameters

Parameter
Type
Description
id
string required
The ID of the class to be retrieved.

Response description

See the Class Model.

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
class_id=<...>
5
url=https://$saymon_hostname/node/api/classes/$class_id
6
7
curl -X GET $url -u $login:$password
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let classID = <...>
5
let auth = "Basic " + btoa(login + ":" + password)
6
let path = "/node/api/classes/" + classID
7
8
let myHeaders = new Headers();
9
myHeaders.append("Authorization", auth);
10
11
let raw = "";
12
13
let requestOptions = {
14
method: 'GET',
15
headers: myHeaders,
16
redirect: 'follow'
17
};
18
19
fetch(saymonHostname + path, requestOptions)
20
.then(response => response.text())
21
.then(result => console.log(result))
22
.catch(error => console.log('error', error));
Copied!
1
let http = require('follow-redirects').http;
2
let fs = require('fs'); let login = <...> let password = <...>' let saymonHostname = <...> let classId = <...> let path = "/node/api/classes/" + classId; let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
3
4
let options = {
5
'method': 'GET',
6
'hostname': '192.168.1.101',
7
'path': '/node/api/classes/4',
8
'headers': {
9
'Authorization': auth
10
},
11
'maxRedirects': 20
12
};
13
14
let req = http.request(options, function (res) {
15
let chunks = [];
16
17
res.on("data", function (chunk) {
18
chunks.push(chunk);
19
});
20
21
res.on("end", function (chunk) {
22
let body = Buffer.concat(chunks);
23
console.log(body.toString());
24
});
25
26
res.on("error", function (error) {
27
console.error(error);
28
});
29
});
30
31
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
class_id = <...>
7
url = "http://" + saymon_hostname + "/node/api/classes/" + class_id
8
9
response = requests.request("GET", url, auth=(login, password))
10
print(response.text)
Copied!

Response example

1
{
2
"id": 4,
3
"name": "CPU",
4
"category_id": 1,
5
"description": "Central Processor Unit",
6
"operations": []
7
}
Copied!