Create Incident
Creates a new incident with data passed in a request body. Returns the created incident in the JSON format.
Request
Body parameters
This request uses the the Incident model.
Incident model
| Field | Type | Description |
|---|---|---|
acknowledgedBy |
String |
ID of a user who acknowledged the incident. |
acknowledgementTimestamp |
Integer |
A timestamp when the incident was acknowledged. |
branchId |
String |
Condition branch ID. Used for incidents generated by custom incident conditions. |
clearTimestamp |
Integer |
A timestamp when the incident was cleared. |
comment |
String |
Incident’s latest comment. |
commentedBy |
String |
ID of a user who last commented on the incident. |
commentTimestamp |
Integer |
A timestamp when the latest comment was added to an incident. |
commentsCount |
Integer |
Amount of comments on this incident. |
count |
Integer |
Number of times this alarm has been generated. |
data |
String |
Entity’s data. |
entityId |
String |
ID of an entity for which the incident happened. |
entityType |
Integer |
Type of the entity. It’s equal to |
id |
String |
Incident’s ID. |
lastState |
String |
The ID of the Incident Level that the incident had before it has been marked for clearing. |
localTimestamp |
Integer |
The time the incident occurred. |
owner |
Information about the entity that triggered the incident. |
|
parentChainId |
String |
Origin of a link that triggered an incident. Included only for incidents of type |
properties |
Array<Key-Value Pair> |
A list of incident’s properties. |
reason |
Object |
Reason for an incident generation. See Reason article for more information. |
reason.code |
Integer |
ID of the reason for an incident generation. See the Reason Codes section for a list of all reason code. |
reason.data |
Object |
Additional information about the state change condition. |
reason.rootCause |
String |
Root-cause transition information. See the Root cause section. |
reason.branch |
Object |
Condition that triggered the incident. See the Branch section for more information. |
removed |
Object |
Information about incident removal with the Clear and Remove Incident request. |
removed.userId |
Object |
ID of a user who removed the incident. |
removed.timestamp |
Object |
Time of the incident removal. |
state |
String |
The ID of the current Incident Level. |
text |
String |
Incident’s description. |
timestamp |
Integer |
The timestamp when the incident was registered in the system. |
type |
Integer |
The type of incident. Possible types are:
|
Request body
To create a new incident, you need to specify the following data in the request body:
-
entityId– ID of the entity for which to generate an incident; -
entityType– ID of the entity for which to generate an incident.1– object,2– link; -
state– new state of the specified entity; -
text– incident text.
You can find further information on the model on the glossary:alarms.adoc#model page.
{
"entityId": "67f92159c07fef08b195bb48",
"entityType": 1,
"state": 4,
"text": "New Alarm",
"timestamp": 1741103731462
}
Response
The response contains the created incident in the JSON format. See the Object model page for more information.
Examples
Request
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/incidents
curl -X POST $url -u $login:$password \
-H "Content-Type: application/json" \
-d @- <<EOF
{
"entityId": "67f92159c07fef08b195bb48",
"entityType": 1,
"state": 4,
"text": "New Alarm",
"timestamp": 1741103731462
}
EOF
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/incidents";
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Authorization", auth);
let data = JSON.stringify({
"entityId": "67f92159c07fef08b195bb48",
"entityType": 1,
"state": 4,
"text": "New Alarm",
"timestamp": 1741103731462
}
);
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 path = "/node/api/incidents";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "POST",
"hostname": saymonHostname,
"headers": {
"Authorization": auth,
"Content-Type": "application/json"
},
"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);
});
});
let data = JSON.stringify({
"entityId": "67f92159c07fef08b195bb48",
"entityType": 1,
"state": 4,
"text": "New Alarm",
"timestamp": 1741103731462
});
req.write(data);
req.end();
import requests
login = <...>
password = <...>
saymon_hostname = <...>
url = "https://" + saymon_hostname + "/node/api/incidents"
body = {
"entityId": "67f92159c07fef08b195bb48",
"entityType": 1,
"state": 4,
"text": "New Alarm",
"timestamp": 1741103731462
}
response = requests.request("POST", url, json=body, auth=(login, password))
print(response.text)