Get Incidents History

Returns an array of incidents history records available to a current user.

Request

HTTP Request

GET /node/api/incident-history

Path parameters

No parameters required.

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.

sortField

String

The name of a field used to sort history records.

sortDirection

String

The sorting direction. Possible values are asc and desc which corresponds to ascending and descending directions accordingly.

ownerFilter

String

A filter used for owner data.

filter

Incident Filter

A set of filters. See the Incident Filter article for more information.

Request body

The request body is empty.

Response

Returns an array of incidents history records available to a current user. See the Incident model for more information.

This request doesn’t incident’s type field.

Example

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/incident-history

curl -X GET $url -u $login:$password \
    -G --data-urlencode "limit=2"
let login = <...>
let password = <...>
let saymonHostname = <...>
let queryParams = "limit=2";
let path = "/node/api/incident-history" + "?" + queryParams;
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 queryParams = "limit=2";
let path = "/node/api/incident-history" + "?" + queryParams;
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 = <...>
url = "https://" + saymon_hostname + "/node/api/incident-history"

params = {
    "limit": 2
}

response = requests.request("GET", url, auth=(login, password), params=params)
print(response.text)

Response

[
    {
        "entityId": "5e21b85b308c3c66d64e07d2",
        "entityType": 1,
        "type": 1,
        "parentChainId": "5e21b85b308c3c66d64e07d2",
        "data": "...",
        "text": "No data",
        "localTimestamp": 1579614817826,
        "timestamp": 1579614817826,
        "clearTimestamp": 1579614894499,
        "id": "5e270329f5d0b555d592e938"
    },
    {
        "entityId": "5e21b85b308c3c66d64e07df",
        "entityType": 1,
        "type": 1,
        "parentChainId": "5e21b85b308c3c66d64e07df",
        "data": "...",
        "text": "No data",
        "localTimestamp": 1579614817887,
        "timestamp": 1579614817887,
        "clearTimestamp": 1579614894504,
        "id": "5e270329f5d0b555d592e939"
    },
    ...
]

See Also