Update Preset

PUT /node/api/presets/:id

Updates a preset with data provided in a request body.

Request parameters

Path parameters

Parameter
Type
Description
id
string
required
The ID of a preset to be updated.

Body parameters

...

Response description

...

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
preset_id=<...>
5
url=https://$saymon_hostname/node/api/presets/$preset_id
6
7
curl -X PUT $url -u $login:$password \
8
-H "Content-Type: application/json" \
9
--data '{"name": "Updated preset", "key": "Updated key"}'
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let presetId = <...>
5
let path = "/node/api/presets/" + presetId;
6
let auth = "Basic " + btoa(login + ":" + password);
7
8
let headers = new Headers();
9
headers.append("Content-Type", "application/json");
10
headers.append("Authorization", auth);
11
12
let data = JSON.stringify({
13
"name": "Updated preset",
14
"key": "Updated key"
15
});
16
17
let requestOptions = {
18
method: "PUT",
19
headers: headers,
20
body: data
21
};
22
23
fetch(saymonHostname + path, requestOptions)
24
.then(response => response.text())
25
.then(result => console.log(result))
26
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let presetId = <...>
7
let path = "/node/api/presets/" + presetId;
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
"name": "Updated preset",
39
"key": "Updated key"
40
});
41
42
req.write(data);
43
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
preset_id = <...>
7
url = "https://" + saymon_hostname + "/node/api/presets/" + preset_id
8
9
body = {
10
"name": "Updated preset",
11
"key": "Updated key"
12
}
13
14
response = requests.request("PUT", url, json=body, auth=(login, password))
15
print(response.text)
Copied!

Response example

1
{
2
"name": "Updated preset",
3
"key": "Updated key",
4
"id": "5e70eeaa5b77654f2643a61e"
5
}
Copied!
Last modified 1yr ago