Set Object's Stat Metadata

POST /node/api/objects/:id/stat/meta

Sets object's stat metadata.
Permissions: objectPermissions + (modify-objects | manage-objects).

Request parameters

Path parameters

Parameter
Type
Description
id
string required
The ID of an object whose stat metadata should be set.

Response description

The response body is empty.

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
object_id=<...>
5
url=https://$saymon_hostname/node/api/objects/$object_id/stat/meta
6
7
curl -X POST $url -u $login:$password \
8
-H "Content-Type: application/json" \
9
-d @- <<EOF
10
{
11
"percentageUsage": {
12
"wait": {
13
"type": "PERCENTILE",
14
"changeRate": "ALWAYS"
15
},
16
"system": {
17
"type": "PERCENTILE",
18
"changeRate": "ALWAYS"
19
},
20
"user": {
21
"type": "PERCENTILE",
22
"changeRate": "ALWAYS"
23
},
24
"nice": {
25
"type": "PERCENTILE",
26
"changeRate": "ALWAYS"
27
}
28
}
29
}
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let objectId = <...>
5
let path = "/node/api/objects/" + objectId + "/stat/meta";
6
let auth = "Basic " + btoa(login + ":" + password);
7
8
let headers = new Headers();
9
headers.append("Authorization", auth);
10
headers.append("Content-Type", "application/json");
11
12
let data = JSON.stringify({
13
"percentageUsage": {
14
"wait": {
15
"type": "PERCENTILE",
16
"changeRate": "ALWAYS"
17
},
18
"system": {
19
"type": "PERCENTILE",
20
"changeRate": "ALWAYS"
21
},
22
"user": {
23
"type": "PERCENTILE",
24
"changeRate": "ALWAYS"
25
},
26
"nice": {
27
"type": "PERCENTILE",
28
"changeRate": "ALWAYS"
29
}
30
}
31
});
32
33
let requestOptions = {
34
method: "POST",
35
headers: headers,
36
body: data
37
};
38
39
fetch(saymonHostname + path, requestOptions)
40
.then(response => response.text())
41
.then(result => console.log(result))
42
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let objectId = <...>
7
let path = "/node/api/objects/" + objectId + "/stat/meta";
8
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
9
10
let options = {
11
"method": "POST",
12
"hostname": saymonHostname,
13
"headers": {
14
"Authorization": auth,
15
"Content-Type": "application/json"
16
},
17
"path": path
18
};
19
20
let req = http.request(options, function (res) {
21
let chunks = [];
22
23
res.on("data", function (chunk) {
24
chunks.push(chunk);
25
});
26
27
res.on("end", function (chunk) {
28
let body = Buffer.concat(chunks);
29
console.log(body.toString());
30
});
31
32
res.on("error", function (error) {
33
console.error(error);
34
});
35
});
36
37
let data = JSON.stringify({
38
"percentageUsage": {
39
"wait": {
40
"type": "PERCENTILE",
41
"changeRate": "ALWAYS"
42
},
43
"system": {
44
"type": "PERCENTILE",
45
"changeRate": "ALWAYS"
46
},
47
"user": {
48
"type": "PERCENTILE",
49
"changeRate": "ALWAYS"
50
},
51
"nice": {
52
"type": "PERCENTILE",
53
"changeRate": "ALWAYS"
54
}
55
}
56
});
57
58
req.write(data);
59
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
object_id = <...>
7
url = "https://" + saymon_hostname + "/node/api/objects/" + \
8
object_id + "/stat/meta";
9
10
body = {
11
"percentageUsage": {
12
"wait": {
13
"type": "PERCENTILE",
14
"changeRate": "ALWAYS"
15
},
16
"system": {
17
"type": "PERCENTILE",
18
"changeRate": "ALWAYS"
19
},
20
"user": {
21
"type": "PERCENTILE",
22
"changeRate": "ALWAYS"
23
},
24
"nice": {
25
"type": "PERCENTILE",
26
"changeRate": "ALWAYS"
27
}
28
}
29
}
30
31
response = requests.request("POST", url, json=body, auth=(login, password))
32
print(response.text)
Copied!
Last modified 1yr ago