Skip to content

Alert Management

AdamTumi edited this page Oct 24, 2014 · 17 revisions

The Alert API is a REST Interface for handling alerts.

Get List of Alerts

Get a list of all alerts for the specified account.

Param Type Description Value
Authorization HTTP Header Access Token Authorization: Bearer eyJ0eX...
accountId URL Slug The ID of an Account 534da46c820cb9f74a0d3de6
Request
GET /accounts/{accountId}/alerts

Response 200 OK (application/json)
[
{
    "accountId": "0d66c8b6-9f4d-4551-a9c8-d356c2dd033d",
    "alertId": "75",
    "deviceId": "00-00-00-00-a8-9c",
    "ruleId": 6832,
    "ruleName": "rule 2 - basic condition new",
    "priority": "Low",
    "triggered": 1402580459000,
    "created": 1411130946286,
    "naturalLangAlert": "temperature > 17.2",
    "conditions": [
        {
            "sequence": 1,
            "condition": "temperature > 17.2"
        }
    ],
    "status": "New",
    "updated": 1411130946286,
    "_id": "541c2642b3700bcbe9c76fc5"
}
]

Get Alert information

Get specific alert details connected with the account.

Param Type Description Value
Authorization HTTP Header Access Token Authorization: Bearer eyJ0eX...
accountId URL Slug The ID of an Account 0d66c8b6-9f4d-4551-a9c8-d356c2dd033d
alertId URL Slug The ID of an Alert 75
Request
GET /accounts/{accountId}/alerts/{alertId}

Response 200 OK 
{
"accountId": "0d66c8b6-9f4d-4551-a9c8-d356c2dd033d",
"alertId": "75",
"deviceId": "00-00-00-00-a8-9c",
"ruleId": 6832,
"ruleName": "rule 2 - basic condition new",
"priority": "Low",
"triggered": 1402580459000,
"created": 1411130946286,
"naturalLangAlert": "temperature > 17.2",
"conditions": [
    {
        "sequence": 1,
        "condition": "temperature > 17.2",
        "components": [
            {
                "componentId": "e5f09130-c70e-4082-9801-49833c853493",
                "dataType": "Number",
                "componentName": "GA9c-3-Temp.Sensor",
                "valuePoints": [
                    {
                        "timestamp": 1402580459000,
                        "value": "21"
                    }
                ]
            }
        ]
    }
],
"status": "New",
"updated": 1411130946286,
"_id": "541c2642b3700bcbe9c76fc5"
}

Reset Alert

Change alert status to - "Closed". Alert won't be active any more.

Param Type Description Value
Authorization HTTP Header Access Token Authorization: Bearer eyJ0eX...
accountId URL Slug The ID of an Account 0d66c8b6-9f4d-4551-a9c8-d356c2dd033d
alertId URL Slug The ID of an Alert 75
Request
PUT /accounts/{accountId}/alerts/{alertId}/reset

Response 200 OK 

Update Alert status

Change status of the Alert. Status should have one of the following values: ['New', 'Open', 'Closed']

Param Type Description Value
Authorization HTTP Header Access Token Authorization: Bearer eyJ0eX...
accountId URL Slug The ID of an Account 0d66c8b6-9f4d-4551-a9c8-d356c2dd033d
alertId URL Slug The ID of an Alert 75
statusName URL Slug The Name of a new alert status "Closed"
Request
PUT /accounts/{accountId}/alerts/{alertId}/status/{statusName}

Response 200 OK 

Add comments to the Alert

Add list of comments to the alert.

Param Type Description Value
Authorization HTTP Header Access Token Authorization: Bearer eyJ0eX...
Content-Type HTTP Header Type of body content application/json
accountId URL Slug The ID of an Account 0d66c8b6-9f4d-4551-a9c8-d356c2dd033d
alertId URL Slug The ID of an Alert 75
Request
POST /accounts/{accountId}/alerts/{alertId}/comments
[
   {
      "user": "test@example.com",
      "timestamp": 123233231221,
      "text": "comment"
   }
]

Response 200 OK 

You can’t perform that action at this time.