Update Server Configuration

PATCH /node/api/configuration

Updates server configuration.
Permissions: manage-configuration.

Request parameters

...

Response description

...

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
url=https://$saymon_hostname/node/api/configuration
5
6
curl -X PATCH $url -u $login:$password \
7
-H "Content-Type: application/json" \
8
-d @- <<EOF
9
{
10
"server": {
11
"retain_expired_stat": false,
12
"history_update_period": 15000,
13
"stat_scan_period": 1000,
14
"event_log_max_bytes": "1 G",
15
"default_result_timeout": 2000,
16
"incident_timeout": 60000,
17
"email": {
18
"disabled": false,
19
"transport": {
20
"service": "...",
21
"auth": {
22
"user": "[email protected]",
23
"pass": "..."
24
}
25
},
26
"fields": {
27
28
},
29
"max_json_length": 100000
30
},
31
"user": {
32
"new_user_access": "not"
33
}
34
}
35
}
36
EOF
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let path = "/node/api/configuration";
5
let auth = "Basic " + btoa(login + ":" + password);
6
7
let headers = new Headers();
8
headers.append("Content-Type", "application/json");
9
headers.append("Authorization", auth);
10
11
let data = JSON.stringify({
12
"server": {
13
"retain_expired_stat": false,
14
"history_update_period": 15000,
15
"stat_scan_period": 1000,
16
"event_log_max_bytes": "1 G",
17
"default_result_timeout": 2000,
18
"incident_timeout": 60000,
19
"email": {
20
"disabled": false,
21
"transport": {
22
"service": "...",
23
"auth": {
24
"user": "[email protected]",
25
"pass": "..."
26
}
27
},
28
"fields": {
29
30
},
31
"max_json_length": 100000
32
},
33
"user": {
34
"new_user_access": "not"
35
}
36
}
37
});
38
39
let requestOptions = {
40
method: "PATCH",
41
headers: headers,
42
body: data
43
};
44
45
fetch(saymonHostname + path, requestOptions)
46
.then(response => response.text())
47
.then(result => console.log(result))
48
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let path = "/node/api/configuration";
7
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
8
9
let options = {
10
"method": "PATCH",
11
"hostname": saymonHostname,
12
"headers": {
13
"Authorization": auth,
14
"Content-Type": "application/json"
15
},
16
"path": path
17
};
18
19
let req = http.request(options, function (res) {
20
let chunks = [];
21
22
res.on("data", function (chunk) {
23
chunks.push(chunk);
24
});
25
26
res.on("end", function (chunk) {
27
let body = Buffer.concat(chunks);
28
console.log(body.toString());
29
});
30
31
res.on("error", function (error) {
32
console.error(error);
33
});
34
});
35
36
let data = JSON.stringify({
37
"server": {
38
"retain_expired_stat": false,
39
"history_update_period": 15000,
40
"stat_scan_period": 1000,
41
"event_log_max_bytes": "1 G",
42
"default_result_timeout": 2000,
43
"incident_timeout": 60000,
44
"email": {
45
"disabled": false,
46
"transport": {
47
"service": "...",
48
"auth": {
49
"user": "[email protected]",
50
"pass": "..."
51
}
52
},
53
"fields": {
54
55
},
56
"max_json_length": 100000
57
},
58
"user": {
59
"new_user_access": "not"
60
}
61
}
62
});
63
64
req.write(data);
65
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
url = "https://" + saymon_hostname + "/node/api/configuration"
7
8
body = {
9
"server": {
10
"retain_expired_stat": False,
11
"history_update_period": 15000,
12
"stat_scan_period": 1000,
13
"event_log_max_bytes": "1 G",
14
"default_result_timeout": 2000,
15
"incident_timeout": 60000,
16
"email": {
17
"disabled": False,
18
"transport": {
19
"service": "...",
20
"auth": {
21
"user": "[email protected]",
22
"pass": "..."
23
}
24
},
25
"fields": {
26
27
},
28
"max_json_length": 100000
29
},
30
"user": {
31
"new_user_access": "not"
32
}
33
}
34
}
35
36
response = requests.request("PATCH", url, json=body, auth=(login, password))
37
print(response.text)
Copied!

Response example

1
{
2
"server": {
3
"retain_expired_stat": false,
4
"history_update_period": 15000,
5
"stat_scan_period": 1000,
6
"event_log_max_bytes": "1 G",
7
"default_result_timeout": 2000,
8
"incident_timeout": 60000,
9
"email": {
10
"disabled": false,
11
"transport": {
12
"service": "...",
13
"auth": {
14
"user": "[email protected]",
15
"pass": "..."
16
}
17
},
18
"fields": {
19
20
},
21
"max_json_length": 100000
22
},
23
"user": {
24
"new_user_access": "not"
25
}
26
}
27
}
Copied!
Last modified 1yr ago