Find Alarms by Query
This method description defines how Alarm Data Query extends the Entity Data Query. See method 'Find Entity Data by Query' first to get the info about 'Entity Data Query'.
The platform will first search the entities that match the entity and key filters. Then, the platform will use 'Alarm Page Link' to filter the alarms related to those entities. Finally, platform fetch the properties of alarm that are defined in the 'alarmFields' and combine them with the other entity, attribute and latest time series fields to return the result.
See example of the alarm query below. The query will search first 100 active alarms with type 'Temperature Alarm' or 'Fire Alarm' for any device with current temperature > 0. The query will return combination of the entity fields: name of the device, device model and latest temperature reading and alarms fields: createdTime, type, severity and status:
{
"entityFilter": {
"type": "entityType",
"resolveMultiple": true,
"entityType": "DEVICE"
},
"pageLink": {
"page": 0,
"pageSize": 100,
"textSearch": null,
"searchPropagatedAlarms": false,
"statusList": [
"ACTIVE"
],
"severityList": [
"CRITICAL",
"MAJOR"
],
"typeList": [
"Temperature Alarm",
"Fire Alarm"
],
"sortOrder": {
"key": {
"key": "createdTime",
"type": "ALARM_FIELD"
},
"direction": "DESC"
},
"timeWindow": 86400000
},
"keyFilters": [
{
"key": {
"type": "TIME_SERIES",
"key": "temperature"
},
"valueType": "NUMERIC",
"predicate": {
"operation": "GREATER",
"value": {
"defaultValue": 0,
"dynamicValue": null
},
"type": "NUMERIC"
}
}
],
"alarmFields": [
{
"type": "ALARM_FIELD",
"key": "createdTime"
},
{
"type": "ALARM_FIELD",
"key": "type"
},
{
"type": "ALARM_FIELD",
"key": "severity"
},
{
"type": "ALARM_FIELD",
"key": "status"
}
],
"entityFields": [
{
"type": "ENTITY_FIELD",
"key": "name"
}
],
"latestValues": [
{
"type": "ATTRIBUTE",
"key": "model"
},
{
"type": "TIME_SERIES",
"key": "temperature"
}
]
}
Request body
Response
OK
Example response
{
"data": [
{
"entityId": {
"id": "784f394c-42b6-435a-983c-b7beff2784f9",
"entityType": "DEVICE"
},
"id": {
"id": "784f394c-42b6-435a-983c-b7beff2784f9",
"entityType": "ALARM"
},
"createdTime": 1634058704567,
"tenantId": {
"id": "784f394c-42b6-435a-983c-b7beff2784f9",
"entityType": "TENANT"
},
"customerId": {
"id": "784f394c-42b6-435a-983c-b7beff2784f9",
"entityType": "CUSTOMER"
},
"type": "High Temperature Alarm",
"originator": {
"id": "784f394c-42b6-435a-983c-b7beff2784f9",
"entityType": "DEVICE"
},
"severity": "CRITICAL",
"acknowledged": true,
"assigneeId": {
"id": "784f394c-42b6-435a-983c-b7beff2784f9",
"entityType": "USER"
},
"startTs": 1634058704565,
"endTs": 1634111163522,
"ackTs": 1634115221948,
"clearTs": 1634114528465,
"assignTs": 1634115928465,
"propagate": true,
"propagateToOwner": true,
"propagateToTenant": true,
"originatorName": "Thermostat",
"originatorLabel": "Thermostat label",
"originatorDisplayName": "Thermostat",
"assignee": {
"id": {
"id": "784f394c-42b6-435a-983c-b7beff2784f9",
"entityType": "USER"
}
},
"name": "High Temperature Alarm",
"status": "ACTIVE_UNACK",
"details": {}
}
]
}