Skip to content

Get Incident Comment List

Returns a comments list for the given incident.

Note

Incident comments are returned in the reverse order. The latest comment is the first on the list.

Warning

The latest comment isn't included in this list. It is stored in the Incident's comment field. Use the Get Incident by ID request to get the latest comment.

Permissions

To get incident's comments, the user has to have permissions to access the entity for which the incident happened.

Request

HTTP Request

GET /node/api/incidents/:id/comments

Path parameters

Parameter Type Description
id String
required
ID of an incident which comments should be retrieved.

Query parameters

Parameter Type Description
limit Integer The maximum number of records to be retrieved.
skip Integer The number of the first records to be skipped.

Request body

The request body is empty.

Response

Response contains the list of comments. See the Incident comment model page for all available parameters.

Examples

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": "Second to 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"
    }
]