Get Incident Comment History
Returns a comments history for the active incident with the given ID.
To get a comments history for a historic incident, use the Get Comments List for Historic Incident request.
Incident comments are returned in the reverse order. The latest comment is the first on the list. |
Permissions
To get incident’s comments, the user has to have permissions to access the entity for which the incident happened.
Request
Response
Response contains the comments history for the given incident. See the Incident comment model page for all returned fields.
Examples
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
saymon_hostname=<...>
incident_id=<...>
url=https://$saymon_hostname/node/api/incidents/$incident_id/comments
curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let incidentId = <...>
let path = "/node/api/incidents/" + incidentId + "/comments/;
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Authorization", auth);
let requestOptions = {
method: "GET",
headers: headers
};
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 + "/comments";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "GET",
"hostname": saymonHostname,
"headers": {
"Authorization": auth
},
"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);
});
});
req.end();
import requests
login = <...>
password = <...>
saymon_hostname = <...>
incident_id = <...>
url = "https://" + saymon_hostname + "/node/api/incidents/" + \
incident_id + "/comments/
response = requests.request("GET", url, auth=(login, password))
print(response.text)
Response
[
{
"incidentId": "58ac5032c7c8dbda32afb374",
"text": "Last comment",
"author": "62c2f3ce80c8654892764d56",
"timestamp": 1687531681361,
"id": "6495b0b380b6e862cf2f64b7"
}
...
{
"incidentId": "58ac5032c7c8dbda32afb374",
"text": "Second comment",
"author": "55e59fbe7d0ce76f660607b7",
"timestamp": 1687530844658,
"id": "6495b09980b6e862cf2f64a8"
},
{
"incidentId": "58ac5032c7c8dbda32afb374",
"text": "First comment",
"author": "62c2f3ce80c8654892764d56",
"timestamp": 1687530832351,
"id": "6495ad5c80b6e862cf2f633f"
}
]