Returns a list of all alerts generated for an account as per the specified criteria. This API is paginated and returns 20 alerts by default. An alert is uniquely identified by a 'alert_key'. This key should be used in all the other API referencing a particular alert.

Params

Param name Description
page
optional

Page number of results to be fetched, Default 1


Value: Must be Integer.
per
optional

Number of alerts to be returned in one page, Default 20


Value: Must be Integer.
order_by
optional

Field on which alerts should be sorted


Value: Must be a String
order
optional

Order, “asc” or “desc”, in which results should be sorted


Value: Must be a String
search
optional

Keywords based on which alerts should be searched.


Value: Must be a String
scope
optional

Matching condition if multiple keywords are specified for search. Valid values are “all” or “any”. Default is “all”


Value: Must be a String
time_zone
optional

Timezone.


Value: Must be a String
thing_key
optional

Thing for which the alerts should be returned


Value: Must be a String
instruction_key
optional

Instruction for which the alerts should be returned


Value: Must be a String
alert_type
optional

Alert types for which alerts should be returned


Value: Must be an array of [0, 1, 2, 3]
timestamp_format
optional

Format, “str” or “int”, in which timestamps should be returned, Default “int”


Value: Must be a String
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean
is_oem
optional

Returns alerts of child accounts along with things of oem account if is_oem flag is true.


Value: Must be one of: <code>true</code>, <code>false</code>, <code>true</code>, <code>false</code>.

Examples

Request - listing all alerts without any criteria
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:ENDVcVtaZvVuKlSIxKhQbw" https://api.datonis.io/api/v3/alerts

Response (returns first 20 records)
{
  "total_count": 6,
  "page": 1,
  "alerts": [
    {
      "alert_key": "71ta3d639f",
      "alert_type": 0,
      "created_at": 1448449140,
      "data": {
        "thing": {
          "bi_directional": true,
          "coordinates": [
            "21.15",
            "79.09"
          ],
          "created_at": 1448430551,
          "description": "Thing for washing machines",
          "name": "Fully Automated Washing Machine",
          "state": null,
          "tags_array": [
            "Corporate",
            "automated"
          ],
          "thing_key": "92df5df8cb",
          "updated_at": 1448437358,
          "user_defined_properties": {
            "Firmware Ver": "1.0",
            "STATE": "OK",
            "Installation Type": "Free Standing",
            "Manufacturer": "LG",
            "Color": "White"
          },
          "alive": false,
          "tags": "Corporate,automated",
          "last_event": null,
          "last_beat": null,
          "thing_template_name": "Washing Machine",
          "thing_template_key": "831e1tf472"
        },
        "alert_type_string": "Info"
      },
      "message": "Thing Fully Automated Washing Machine registered",
      "timestamp": 1448447,
      "updated_at": 1448449140,
      "alert_type_string": "Info",
      "thing_key": "92df5df8cb",
      "thing_name": "Fully Automated Washing Machine"
    },
    {
      "alert_key": "ee2ad1t5t5",
      "alert_type": 0,
      "created_at": 1448449362,
      "data": {
...
Request - listing alerts by specifying number of alerts to be returned at a time (page size) and specific set to be returned (page)
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:ENDVcVtaZvVuKlSIxKhQbw" -d '{"per":"2","page":"2"}' https://api.datonis.io/api/v3/alerts

Response (returns page 2 with 2 alerts per page)
{
  "total_count": 6,
  "page": "2",
  "alerts": [
    {
      "alert_key": "2b1554f38f",
      "alert_type": 0,
      "created_at": 1448449462,
      "data": {
        "thing": {
          "bi_directional": true,
          "coordinates": [
            20.15,
            78.09
          ],
          "created_at": 1448435611,
          "description": "Thing for Energy Meters",
          "name": "Energy Meter 1",
          "state": null,
          "tags_array": [
            "Residential"
          ],
          "thing_key": "45bf16bb4e",
          "updated_at": 1448435611,
          "user_defined_properties": {
            "Firmware Ver": "1.0",
            "STATE": "OK"
          },
          "alive": false,
          "tags": "Residential",
          "last_event": null,
          "last_beat": null,
          "thing_template_name": "Energy Meter",
          "thing_template_key": "82e2et9c31"
        },
        "alert_type_string": "Info"
      },
      "message": "Thing Energy Meter 1 registered",
      "timestamp": 1448449,
      "updated_at": 1448449462,
      "alert_type_string": "Info",
      "thing_key": "45bf16bb4e",
      "thing_name": "Energy Meter 1"
    },
    {
      "alert_key": "5fbata9e6a",
      "alert_type": 1,
      "created_at": 1448449654,
      "data": {
        "thing": {
          "bi_directional": true,
          "coordinates": [
            20.15,
            78.09
          ],
          "created_at": 1448435611,
          "description": "Thing for...
Request - listing alerts ordered by a field
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:ENDVcVtaZvVuKlSIxKhQbw" -d '{"order_by":"alert_type","order":"desc"}' https://api.datonis.io/api/v3/alerts

Response (returns alerts in the reverse order of alert type)
{
  "total_count": 6,
  "page": 1,
  "alerts": [
    {
      "alert_key": "5fbata9e6a",
      "alert_type": 1,
      "created_at": 1448449654,
      "data": {
        "thing": {
          "bi_directional": true,
          "coordinates": [
            20.15,
            78.09
          ],
          "created_at": 1448435611,
          "description": "Thing for Energy Meters",
          "name": "Energy Meter 1",
          "state": null,
          "tags_array": [
            "Residential"
          ],
          "thing_key": "45bf16bb4e",
          "updated_at": 1448435611,
          "user_defined_properties": {
            "Firmware Ver": "1.0",
            "STATE": "OK"
          },
          "alive": false,
          "tags": "Residential",
          "last_event": null,
          "last_beat": null,
          "thing_template_name": "Energy Meter",
          "thing_template_key": "82e2et9c31"
        },
        "alert_type_string": "Warning"
      },
      "message": "New Alert",
      "timestamp": 1448449,
      "updated_at": 1448449654,
      "alert_type_string": "Warning",
      "thing_key": "45bf16bb4e",
      "thing_name": "Energy Meter 1"
    },
    {
      "alert_key": "36a9t18tfe",
      "alert_type": 1,
      "created_at": 1448449721,
      "data": {
        "thing": {
          "bi_directional": false,
          "coordinates": [
            "20.15",
            "78.09"
          ],
          "created_at": 1448430551,
          "description": "Thing for washing...
Request - listing alerts based on some search criteria with all keywords matching
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:ENDVcVtaZvVuKlSIxKhQbw" -d '{"search":"Semi New"}' https://api.datonis.io/api/v3/alerts

Response (returns alerts containing both keywords 'Semi' as well as 'New')
{
  "total_count": 1,
  "page": 1,
  "alerts": [
    {
      "alert_key": "36a9t18tfe",
      "alert_type": 1,
      "created_at": 1448449721,
      "data": {
        "thing": {
          "bi_directional": false,
          "coordinates": [
            "20.15",
            "78.09"
          ],
          "created_at": 1448430551,
          "description": "Thing for washing machines",
          "name": "Semi Automated Washing Machine",
          "state": null,
          "tags_array": [
            "Residencial",
            "automated"
          ],
          "thing_key": "ta597t738b",
          "updated_at": 1448437372,
          "user_defined_properties": {
            "Firmware Ver": "1.0",
            "STATE": "OK",
            "Installation Type": "Free Standing",
            "Manufacturer": "LG",
            "Color": "Red"
          },
          "alive": false,
          "tags": "Residencial,automated",
          "last_event": null,
          "last_beat": null,
          "thing_template_name": "Washing Machine",
          "thing_template_key": "831e1tf472"
        },
        "alert_type_string": "Warning"
      },
      "message": "New Alert",
      "timestamp": 1448449,
      "updated_at": 1448449721,
      "alert_type_string": "Warning",
      "thing_key": "ta597t738b",
      "thing_name": "Semi Automated Washing Machine"
    }
  ]
}
Request - listing alerts based on some search criteria with any of the keywords matching
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:ENDVcVtaZvVuKlSIxKhQbw" -d '{"search":"Semi New","scope":"any"}' https://api.datonis.io/api/v3/alerts

Response (returns alerts containing either of the keywords 'Semi' or 'New')
{
  "total_count": 3,
  "page": 1,
  "alerts": [
    {
      "alert_key": "36a9t18tfe",
      "alert_type": 1,
      "created_at": 1448449721,
      "data": {
        "thing": {
          "bi_directional": false,
          "coordinates": [
            "20.15",
            "78.09"
          ],
          "created_at": 1448430551,
          "description": "Thing for washing machines",
          "name": "Semi Automated Washing Machine",
          "state": null,
          "tags_array": [
            "Residencial",
            "automated"
          ],
          "thing_key": "ta597t738b",
          "updated_at": 1448437372,
          "user_defined_properties": {
            "Firmware Ver": "1.0",
            "STATE": "OK",
            "Installation Type": "Free Standing",
            "Manufacturer": "LG",
            "Color": "Red"
          },
          "alive": false,
          "tags": "Residencial,automated",
          "last_event": null,
          "last_beat": null,
          "thing_template_name": "Washing Machine",
          "thing_template_key": "831e1tf472"
        },
        "alert_type_string": "Warning"
      },
      "message": "New Alert",
      "timestamp": 1448449,
      "updated_at": 1448449721,
      "alert_type_string": "Warning",
      "thing_key": "ta597t738b",
      "thing_name": "Semi Automated Washing Machine"
    },
    {
      "alert_key": "5fbata9e6a",
      "alert_type": 1,
      "created_at": 1448449654,
      "data": {
        "thing": {
         ...
Request - listing alerts for a thing
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:ENDVcVtaZvVuKlSIxKhQbw" -d '{"thing_key":"ta597t738b"}' https://api.datonis.io/api/v3/alerts

Response (returns alerts generated for a thing with key mentioned above)
{
  "total_count": 2,
  "page": 1,
  "alerts": [
    {
      "alert_key": "36a9t18tfe",
      "alert_type": 1,
      "created_at": 1448449721,
      "data": {
        "thing": {
          "bi_directional": false,
          "coordinates": [
            "20.15",
            "78.09"
          ],
          "created_at": 1448430551,
          "description": "Thing for washing machines",
          "name": "Semi Automated Washing Machine",
          "state": null,
          "tags_array": [
            "Residencial",
            "automated"
          ],
          "thing_key": "ta597t738b",
          "updated_at": 1448437372,
          "user_defined_properties": {
            "Firmware Ver": "1.0",
            "STATE": "OK",
            "Installation Type": "Free Standing",
            "Manufacturer": "LG",
            "Color": "Red"
          },
          "alive": false,
          "tags": "Residencial,automated",
          "last_event": null,
          "last_beat": null,
          "thing_template_name": "Washing Machine",
          "thing_template_key": "831e1tf472"
        },
        "alert_type_string": "Warning"
      },
      "message": "New Alert",
      "timestamp": 1448449,
      "updated_at": 1448449721,
      "alert_type_string": "Warning",
      "thing_key": "ta597t738b",
      "thing_name": "Semi Automated Washing Machine"
    },
    {
      "alert_key": "ee2ad1t5t5",
      "alert_type": 0,
      "created_at": 1448449362,
      "data": {
        "thing": {
         ...
Request - listing alerts for an instruction
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:ENDVcVtaZvVuKlSIxKhQbw" -d '{"instruction_key":"t4bd14d659"}' https://api.datonis.io/api/v3/alerts

Response (returns alerts generated for a instruction with key mentioned above)
{
  "total_count": 1,
  "page": 1,
  "alerts": [
    {
      "alert_key": "6abfc13459",
      "alert_type": 0,
      "created_at": 1448451693,
      "data": {
        "thing": {
          "bi_directional": true,
          "coordinates": [
            20.15,
            78.09
          ],
          "created_at": 1448435611,
          "description": "Thing for Energy Meters",
          "name": "Energy Meter 1",
          "state": null,
          "tags_array": [
            "Residential"
          ],
          "thing_key": "45bf16bb4e",
          "updated_at": 1448435611,
          "user_defined_properties": {
            "Firmware Ver": "1.0",
            "STATE": "OK"
          },
          "alive": false,
          "tags": "Residential",
          "last_event": null,
          "last_beat": null,
          "thing_template_name": "Energy Meter",
          "thing_template_key": "82e2et9c31"
        },
        "instruction": {
          "definition": {
            "command": 1
          },
          "description": null,
          "instruction_key": "t4bd14d659",
          "name": "Turn ON",
          "created_at": 1448275718,
          "updated_at": 1448275718
        },
        "alert_type_string": "Info"
      },
      "message": "Instruction Turn ON sent to Energy Meter1",
      "timestamp": 1448451,
      "updated_at": 1448451693,
      "alert_type_string": "Info",
      "thing_key": "45bf16bb4e",
      "thing_name": "Energy Meter 1",
      "instruction_key": "t4bd14d659",...
Request - listing alerts of one or more types (levels)
  curl -X GET  -H "Content-Type:application/json" -H "X-Auth-Token:ENDVcVtaZvVuKlSIxKhQbw" -d '{"alert_type":[1]}' https://api.datonis.io/api/v3/alerts

Response (containing alerts of type 1 i.e. WARNING)
{
  "total_count": 2,
  "page": 1,
  "alerts": [
    {
      "alert_key": "36a9t18tfe",
      "alert_type": 1,
      "created_at": 1448449721,
      "data": {
        "thing": {
          "bi_directional": false,
          "coordinates": [
            "20.15",
            "78.09"
          ],
          "created_at": 1448430551,
          "description": "Thing for washing machines",
          "name": "Semi Automated Washing Machine",
          "state": null,
          "tags_array": [
            "Residencial",
            "automated"
          ],
          "thing_key": "ta597t738b",
          "updated_at": 1448437372,
          "user_defined_properties": {
            "Firmware Ver": "1.0",
            "STATE": "OK",
            "Installation Type": "Free Standing",
            "Manufacturer": "LG",
            "Color": "Red"
          },
          "alive": false,
          "tags": "Residencial,automated",
          "last_event": null,
          "last_beat": null,
          "thing_template_name": "Washing Machine",
          "thing_template_key": "831e1tf472"
        },
        "alert_type_string": "Warning"
      },
      "message": "New Alert",
      "timestamp": 1448449,
      "updated_at": 1448449721,
      "alert_type_string": "Warning",
      "thing_key": "ta597t738b",
      "thing_name": "Semi Automated Washing Machine"
    },
    {
      "alert_key": "5fbata9e6a",
      "alert_type": 1,
      "created_at": 1448449654,
      "data": {
        "thing": {
         ...