Set Incident Properties
Request
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"
}
}