Add Incident Comment
Adds a comment for an incident.
If this incident already had a comment, the older comment is pushed into the list of comment incidents. The new comment is then stored in the comment
field of the incident.
You can get older comments with Get Incident Comments request.
Request
Path parameters
Parameter | Type | Description |
---|---|---|
id |
String |
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. This string can be formatted as Markdown. See the Showdown documentation for a detailed description of the used Markdown flavor.
You should specify the Content-Type header as text/plain . Otherwise, incident’s comment field will be set to null .
|
Response
The response body is empty.
When you send this request, incident’s comment
field will be added or updated. If the comment
field wasn’t empty, the old comment is put into the incident’s comment list. You can get older comments with Get Incident Comments request.
Example
Request
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
saymon_hostname=<...>
incident_id=<...>
url=https://$saymon_hostname/node/api/incidents/$incident_id/comment
curl -X POST $url -u $login:$password \
-H "Content-Type: text/plain" \
--data 'Hello from REST API!'
let login = <...>
let password = <...>
let saymonHostname = <...>
let incidentId = <...>
let path = "/node/api/incidents/" + incidentId + "/comment";
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Content-Type", "text/plain");
headers.append("Authorization", auth);
let data = "Hello from REST API!";
let requestOptions = {
method: "POST",
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 incidentId = <...>
let path = "/node/api/incidents/" + incidentId + "/comment";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "POST",
"hostname": saymonHostname,
"headers": {
"Authorization": auth,
"Content-Type": "text/plain"
},
"path": path
};
let req = https.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 = "Hello from REST API!";
req.write(data);
req.end();
import requests
login = <...>
password = <...>
saymon_hostname = <...>
incident_id = <...>
url = "https://" + saymon_hostname + "/node/api/incidents/" + \
incident_id + "/comment"
headers = {
"Content-Type": "text/plain"
}
comment = "Hello from REST API!"
response = requests.request("POST", url, data=comment,
headers=headers, auth=(login, password))
print(response.text)