Get Favorites
Returns current user's favorites.
If you need to get favorites of another user, use the Get All Users or Get User by ID requests.
Request
HTTP Request
Request body
The request body is empty.
Response
Returns a set of user's favorites.
Favorites don't have a fixed structure, so favorites may return a custom set of variables.
The recommended structure is described in the Favorites model.
Example
Request
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/users/favorites";
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/users/favorites";
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": "My favorites"
"objects": [
"5e21b752308c3c66d64e072c",
"6315fc710f3d71351b6609c8"
],
"links": [
"5e4fc1c77915112ac209e53d",
"5c541db3347bb9002714d002"
],
"operations": [
{
"id": "5e21b85b308c3c66d64e07bc",
"entityType": 1,
"entityId": "5e21b752308c3c66d64e072c"
},
{
"id": "5c541db3347bb9002714d003",
"entityType": 1,
"entityId": "5e21b752308c3c66d64e072c"
}
],
"graphs": [
{
"metric": "stdout.m1",
"entityType": 1,
"entityId": "5e21b752308c3c66d64e072c",
},
{
"metric": "stdout.m2",
"entityType": 1,
"entityId": "5e21b752308c3c66d64e072c",
},
{
"metric": "TOTAL.bytesUsed",
"entityType": 1,
"entityId": "5c541dc5347bb9002714d17c",
}
]
}
]