Alarms API

The Alarms API allows the Site Alarms to be queried and cleared.

HTML Method URI Action
GET /sites/{SITE_ID}/alarms Get Site Alarms
PUT /sites/{SITE_ID}/alarms Clear Site Alarms

Get Site Alarms

URI Parameters: SITE_ID

Additional Optional URI Parameters:

Parameter Type Description Example
startTime ISO 8601 First Alarm time will be >= Date/Time 2019-06-30T22:00:00+10:00
endTime ISO 8601 Last Alarm time will be < Date/Time 2020-12-01T08:30:00+10:00
limit Integer Maximum number of Alarms to return 10
order String Time order to return (Asc or Desc) [1] Desc
timezone String Timezone to return time values in [2] Australia/Sydney
[1]“Asc” for Ascending order , “Desc” for Descending order. Default is “Asc”
[2]Defaults to the Site’s timezone. If the startTime or endTime parameters do not explicitly include a timezone then this timezone will be used when interpreting those values. “/” character must be encoded as %2F.

Parameter Examples:

/sites/1000/alarms?startTime=2019-01-01T00:00:00Z&limit=500&order=desc&timezone=Australia%2FSydney

HTML Method: GET

Example:

curl -H 'X-Api-Key: API_KEY’ https://www.telemetry.net.au/api/v1/sites/1000/alarms

Returns: If the call succeeds, returns the Alarms in the following format.

{
        "alarmCount":1,
        "alarms":
        [
                {
                        "id":"1234",
                        "occurredAt":"2019-12-01T17:17:40+10:00",
                        "subject":"Alarm from Test Site",
                        "message":"Temperature High: 57c",
                        "cleared":"true",
                        "clearedAt":"2019-12-02T09:00:00+10:00",
                        "comment":"all ok",
                        "clearedBy":"John Smith"
                }
        ]
}
Field Description
id Internal unique identifier for the Alarm
occurredAt Time when the Alarm occurred
subject Short description of the Alarm
message Detailed description of the Alarm
cleared true if a user has manually cleared the Alarm, else false
clearedAt Time when the Alarm was cleared
comment Comment entered when Alarm was cleared
clearedBy The name of the person that cleared the Alarm

Clear Site Alarms

URI Parameters: SITE_ID

HTML Method: PUT

PUT Data: JSON format specifying the fields to set in one or more Alarms. The only valid fields are “cleared”, “clearedAt” and “comment”. The “id” must also be included to specify the Alarm instance to be modified.

Example:

curl -X PUT -H "Content-Type: application/json" -H 'X-Api-Key: API_KEY' --data '{"alarms":[{"id":"1234", "cleared":"true", "clearedAt":"2020-05-11T15:00:00+10:00", "comment":"Cleared by API"},{"id":"1235", "cleared":"true","comment":"Cleared by API 2"}]}' https://www.telemetry.net.au/api/v1/sites/1000/alarms

Returns: If the call succeeds, returns the modified alarms in JSON format.

Note

API Key must have write access