Add Comment For Incident

POST /node/api/incidents/:id/comment

Adds a comment for an incident.

Request parameters

Path parameters

Parameter
Type
Description
id
string
required
The ID of an incident for which a comment should be added.

Body parameters

The body should contain a comment as a plain-text string. Note that you should also specify the Content-Type header as text/plain.

Response description

The response body is empty.

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
incident_id=<...>
5
url=https://$saymon_hostname/node/api/incidents/$incident_id/comment
6
7
curl -X POST $url -u $login:$password \
8
-H "Content-Type: text/plain" \
9
--data 'Hello from REST API!'
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let incidentId = <...>
5
let path = "/node/api/incidents/" + incidentId + "/comment";
6
let auth = "Basic " + btoa(login + ":" + password);
7
8
let headers = new Headers();
9
headers.append("Content-Type", "text/plain");
10
headers.append("Authorization", auth);
11
12
let data = "Hello from REST API!";
13
14
let requestOptions = {
15
method: "POST",
16
headers: headers,
17
body: data
18
};
19
20
fetch(saymonHostname + path, requestOptions)
21
.then(response => response.text())
22
.then(result => console.log(result))
23
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let incidentId = <...>
7
let path = "/node/api/incidents/" + incidentId + "/comment";
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": "text/plain"
16
},
17
"path": path
18
};
19
20
let req = https.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 = "Hello from REST API!";
38
39
req.write(data);
40
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
incident_id = <...>
7
url = "https://" + saymon_hostname + "/node/api/incidents/" + \
8
incident_id + "/comment"
9
10
headers = {
11
"Content-Type": "text/plain"
12
}
13
14
comment = "Hello from REST API!"
15
16
response = requests.request("POST", url, data=comment,
17
headers=headers, auth=(login, password))
18
19
print(response.text)
Copied!
Last modified 1yr ago