Set Incident Properties

Add or modify properties of an incident with the specified ID.

In this context, a property is a key-value pair, where a key is the name of the property.

Not to be confused with the Property model.

Request

HTTP Request

POST /node/api/incidents/:id/props

Path parameters

Parameter Type Description

id

String
required

The ID of an incident for which a property should be added.

Body parameters

Request body contains a set of properties that should be added to the incident.

Request body

{
    "foo": 1,
    "bar": "second",
    "object": {
        "variable": "value"
    },
    "array": [
        1,
        2,
        3
    ]
}

Response

Response body contains the updated incident.

Examples

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
incident_id=<...>
url=https://$saymon_hostname/node/api/incidents/$incident_id/props

curl -X POST $url -u $login:$password \
    -H "Content-Type: application/json" \
    -d @- <<EOF
{
"foo": 1,
"bar": "second"
}
EOF
let login = <...>
let password = <...>
let saymonHostname = <...>
let incidentId = <...>
let path = "/node/api/incidents/" + incidentId + "/props";
let auth = "Basic " + btoa(login + ":" + password);

let headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Authorization", auth);

let data = JSON.stringify({
"foo": 1,
"bar": "second"
});

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 request = require("request");
const fs = require("fs");

let login = <...>
let password = <...>
let saymon_hostname = <...>
let incident_id = <...>
let url = "https://" + saymon_hostname + "/node/api/incidents/" +
    incident_id + "/props";

let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let body = JSON.stringify({
"foo": 1,
"bar": "second"
});

let options = {
    method: "POST",
    url: url,
    headers: {
        Authorization: auth
    },
    json : body
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);
});
import requests
import json

login = <...>
password = <...>
saymon_hostname = <...>
incident_id = <...>
url = "https://" + saymon_hostname + "/node/api/incidents/" + \
    incident_id + "/props"

body = {
"foo": 1,
"bar": "second"
}

response = requests.request("POST", url, json=body, auth=(login, password))
print(response.text)

Response

{
    "id": "62bda3ce7e66ea4c50c8efd4",
    "entityId": "5c9104ba9344f77f8c5fc196",
    "entityType": 1,
    "type": 1,
    "data": "{}",
    "lastState": 1,
    "localTimestamp": null,
    "parentChainId": "5c9104ba9344f77f8c5fc196",
    "reason": {
        "code": 4,
        "data": "{\"exceptionClass\":\"java.net.ConnectException\",\"message\":\"Connection refused (Connection refused)\"}"
    },
    "state": 1,
    "text": null,
    "timestamp": 1656595406252,
    "clearTimestamp": 1676896920904,
    "properties": {
        "foo": 1,
        "bar": "second"
    }
}