Update Preset
Updates a preset with data provided in a request body.
Request
HTTP Request
Path parameters
Parameter | Type | Description |
---|---|---|
id | Stringrequired |
The ID of a preset to be updated. |
Body parameters
Field | Type | Description |
---|---|---|
name | String | Name of the preset. |
key | String | Preset key. Used to filter presets. See the list of all pre-defined keys in the Preset Data section. |
data | Object | Preset data. See the Preset Data for more information. |
Request body
Response
Returns the updated preset. See the Preset for more information.
Example
Request
let login = <...>
let password = <...>
let saymonHostname = <...>
let presetId = <...>
let path = "/node/api/presets/" + presetId;
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Authorization", auth);
let data = JSON.stringify({
"name": "Updated preset",
"key": "Updated key"
});
let requestOptions = {
method: "PUT",
headers: headers,
body: data
};
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 presetId = <...>
let path = "/node/api/presets/" + presetId;
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "PUT",
"hostname": saymonHostname,
"headers": {
"Authorization": auth,
"Content-Type": "application/json"
},
"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);
});
});
let data = JSON.stringify({
"name": "Updated preset",
"key": "Updated key"
});
req.write(data);
req.end();
import requests
login = <...>
password = <...>
saymon_hostname = <...>
preset_id = <...>
url = "https://" + saymon_hostname + "/node/api/presets/" + preset_id
body = {
"name": "Updated preset",
"key": "Updated key"
}
response = requests.request("PUT", url, json=body, auth=(login, password))
print(response.text)