Skip to content

Add Incident Comment

Adds a comment for an incident.

Request

HTTP Request

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

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.

Warning

You should specify the Content-Type header as text/plain. Otherwise, incident's comment field will be set to null.

Request body

The request body is empty.

Response

The response body is empty.

When you send this request, incident's comment field will be added or updated.

Example

Request

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)

See Also