Set Link's Manual State

PUT /node/api/links/:id/manual-state

Sets a link's manual state. Returns a JSON representation of the updated link.
Permissions: linkPermissions & (modify-links | manage-links).

Request parameters

Path parameters

Parameter
Type
Description
id
string
required
The ID of a link whose state should be set.

Body parameters

Parameter
Type
Description
by
integer
optional
A timestamp when the state should be unset.
clear
string
optional
Whether to clear the previously set state. If set to true, the stateId parameter is not required.
clearedByState
array
optional
A list of states that triggers cleaning of the current state.
reason
boolean
optional
The reason why the state was set.
since
integer
optional
A timestamp when the state was set.
stateId
string
required
The ID of a state to be set.

Response description

...

Examples

Request examples

Here is how you can set a new state:
Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
link_id=<...>
5
url=https://$saymon_hostname/node/api/links/$link_id/manual-state
6
7
curl -X PUT $url -u $login:$password \
8
-H "Content-Type: application/json" \
9
-d @- <<EOF
10
{
11
"stateId": 3,
12
"clear": false,
13
"reason": "Testing"
14
}
15
EOF
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let linkId = <...>
5
let path = "/node/api/links/" + linkId + "/manual-state";
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
"stateId": 3,
14
"clear": false,
15
"reason": "Testing"
16
});
17
18
let requestOptions = {
19
method: "PUT",
20
headers: headers,
21
body: data
22
};
23
24
fetch(saymonHostname + path, requestOptions)
25
.then(response => response.text())
26
.then(result => console.log(result))
27
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let linkId = <...>
7
let path = "/node/api/links/" + linkId + "/manual-state";
8
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
9
10
let options = {
11
"method": "PUT",
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
"stateId": 3,
39
"clear": false,
40
"reason": "Testing"
41
});
42
43
req.write(data);
44
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
link_id = <...>
7
url = "https://" + saymon_hostname + "/node/api/links/" + \
8
link_id + "/manual-state";
9
10
body = {
11
"stateId": 3,
12
"clear": false,
13
"reason": "Testing"
14
}
15
16
response = requests.request("PUT", url, json=body, auth=(login, password))
17
print(response.text)
Copied!
Here is how you can unset a state:
Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
link_id=<...>
5
url=https://$saymon_hostname/node/api/links/$link_id/manual-state
6
7
curl -X PUT $url -u $login:$password \
8
-H "Content-Type: application/json" \
9
--data '{"clear": true}'
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let linkId = <...>
5
let path = "/node/api/links/" + linkId + "/manual-state";
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
"clear": true
14
});
15
16
let requestOptions = {
17
method: "PUT",
18
headers: headers,
19
body: data
20
};
21
22
fetch(saymonHostname + path, requestOptions)
23
.then(response => response.text())
24
.then(result => console.log(result))
25
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let linkId = <...>
7
let path = "/node/api/links/" + linkId + "/manual-state";
8
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
9
10
let options = {
11
"method": "PUT",
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
"clear": true,
39
});
40
41
req.write(data);
42
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
link_id = <...>
7
url = "https://" + saymon_hostname + "/node/api/links/" + \
8
link_id + "/manual-state";
9
10
body = {
11
"clear": True
12
}
13
14
response = requests.request("PUT", url, json=body, auth=(login, password))
15
print(response.text)
Copied!

Response example

1
{
2
"id": "5e79fddb6ec5ea28e5105f65",
3
"source": "5e79baae6ec5ea28e5105caa",
4
"target": "5e79bbe86ec5ea28e5105d04",
5
"owner_id": "5e21b752308c3c66d64e072c",
6
"weight": 42,
7
"tags": [],
8
"last_state_update": 1585124964884,
9
"updated": 1585124964878,
10
"created": 1585053147047,
11
"state_id": 9,
12
"class_id": 35,
13
"_stateConditionRefs": [],
14
"operations": [],
15
"properties": [
16
{
17
"name": "Bus_(computing).pdf",
18
"value": "upload_a81d451eeebde3da52f7f83a6b83f78f",
19
"type_id": 7,
20
"id": "5e7a04dc6ec5ea28e5105f7e"
21
}
22
],
23
"manual_state": null
24
}
Copied!
Last modified 8mo ago