Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Showing all the open alerts

Hui Jiang edited this page Jun 27, 2017 · 7 revisions

To show the open alerts in the user interface, the client should show them in pages, starting from the most recent.

To retrieve all the alerts regardless of the device, the UI invokes the Device Telemetry web service without passing a list of devices. On the other hand, it's also possible to request alerts for a list of devices, using the same syntax used to retrieve telemetry.

Retrieve all the non-closed alerts

In this example, the UI retrieves the 10 most recent alerts. If there are more alerts, the $metadata field will contain a link to the next page.

Request

Request with GET:

GET {Device Telemetry endpoint}/alerts?status=!closed&from={time}&to={time}&order=desc&limit=10

Response

Content-Type: application/json; charset=utf-8

{
    Count: ...
    Items: [
        {
            deviceid
            time
            description
            status (open | acknowledged)
            $metadata
        },
        {
            deviceid
            time
            description
            status (open | acknowledged)
            $metadata
        },
        ...
    ]
    "$metadata": {
        $type: AlertsList;1
        $uri: ...
        $next: {Device Telemetry endpoint}/alerts?status=!closed&from={time}&to={time}&order=desc&limit=10&skip={...}
    }
}