Skip to content

Query alert

GET /alert/<alertKs>?fields=...&actions=...

Description

Query alert details. This API call will work for both an open and closed alert.

Path parameters

Param Description
alertKs Alert key string (ks).

Query parameters

Param Default Description
fields all fields Fields to return (see fields below for all available fields).
actions none Action fields. If at least one field is given, the result will include "actions" with an array of action objects (see Actions below for all available action fields).

Fields

Field Return type Description
ks string Key string of the alert.
message string Initial message when the alert was opened.
severity integer Initial severity when the alert was opened (value between 0=highest and 7=lowest severity).
timestamp integer Unix timestamp in seconds when the alert was opened.
lastMessage string Message of the last hit (equal to "message" with only a single hit).
lastSeverity integer Severity of the last hit (equal to "severity" with only a single hit).
lastTimestamp integer Unix timestamp in seconds of the last hit (equal to "timestamp" with only a single hit).
ownerId integer/null User Id of the owner or null when the alert is not assigned to an owner.
closedTimestamp integer/null Unix timestamp in seconds when the alert was closed or null if not closed.

Actions

Action field Return type Description
kind string One of: Assign, Comment, IntegrationCall, Close, AutoClose, IndirectClose
timestamp integer Unix timestamp in seconds.
data object/null Additional data object.

Return codes

Error code Reason
200 Success.
400 Unknown field or action or invalid alert key string.
401 Invalid or missing token.
403 Insufficient permissions (required: API+READ).
404 Alert not found.

Example

Curl request:

curl \
    -X GET 'https://api.infrasonar.com/alert/xxx?actions=kind,timestamp,data' \
    -H 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

Response:

{
    "ks": "<a-unique-key-string>",
    "message": "Initial message of the alert",
    "severity": 3,
    "timestamp": 1667511262,
    "lastMessage": "Last message of the alert",
    "lastSeverity": 3,
    "lastTimestamp": 1667511523,
    "ownerId": 123,
    "closedTimestamp": null,
    "actions": [
        {
            "kind": "Assign",
            "timestamp": 1667511469,
            "data": {
                "userId": 123,
                "ownerId": 123,
                "message": "Alert assigned to me!"
            }
        }
    ]
}