getAlarmMessage (getAlarmMessage: Query user alarm information)
getAlarmMessage: getAlarmMessage: Query user alarm information
Legacy HTTP retained: New integrations can use Alarm messages (
device.message.list) for the related capability. The two interfaces are not a one-to-one replacement. device.message.* is a related entry, not a one-to-one replacement of this HTTP method.
Function details
Get the device message list of the device channel in the specified time period.
Legacy OpenAPI pagination. Capability event history: Query alarm history (
device.message.list).
Request address
https://openapi-[DataCenter].easy4ip.com/openapi/getAlarmMessage
Request format
HTTP POST. JSON body layout: Request conventions. Sign with Signature.
Minimum permissions required for sub-account token request
"Permission":"Alarm" "Resource":"cam:serial number:channel number"
Incoming parameter description
| Parameter name | Parameter type | Required or not | Default value | Legal value | Parameter description |
|---|---|---|---|---|---|
| token | String | Yes | Administrator or sub-account accessToken | ||
| deviceId | String | Yes | Device serial number | ||
| channelId | String | Yes | Channel Number | ||
| beginTime | String | Yes | Start time, yyyy-MM-dd HH:mm:ss | ||
| endTime | String | Yes | End time, yyyy-MM-dd HH:mm:ss | ||
| count | Integer | No | 30 | [1,100] | The total number of alarms extracted, [1,100] a positive integer |
| nextAlarmId | String | No | "-1" | "","-1", the nextAlarmId returned by the last query | the next alarm Id |
Sample input
{
"system":{
"ver":"1.0",
"appId":"lcdxxxxxxxxx",
"sign": "xjhCQBoJ9hRDsCjyDcHjtDNzRZ3ZJezcawsfWeiaoxU=",
"time":1603350704,
"nonce":"245db3c7-1689-4893-ac30-cbd7a9d8d153"
},
"id":"9f05aa70-91fd-4d35-8b06-cd2ece55346b",
"params":{
"count":"10",
"beginTime":"2020-10-22 00:00:00",
"endTime":"2020-10-22 23:59:59",
"deviceId":"TESTQWERXXXX",
"channelId":"0",
"nextAlarmId":"-1",
"token":"At_00000ad9e6e87f0142eb92e207aec46a"
}
}
Return data field description
| Field | Type | Description |
|---|---|---|
| count | Integer | Total number of current extracted alarms |
| alarms.token | String | The unique identifier of the message, used to query cloud recordings |
| alarms.time | Long | UNIX timestamp of alarm time (unit: second) |
| alarms.channelId | String | Channel number |
| alarms.name | String | Channel name |
| alarms.alarmId | Long | Message Id |
| alarms.localDate | String | The local time of the device at the time of alarm |
| alarms.type | Integer | Alarm type, 0: human infrared; 1: dynamic detection; 2: unknown alarm; 3: low voltage alarm; 4: infrared detection of accessories human body; 5: movement event of the mobile sensor; 6: long-term movement of the mobile sensor No movement event occurred; 7: Long-term non-alarm event due to infrared detection of accessory human body; 8: Door sensor alarm event; 90: Alarm gateway door sensor detection alarm; 91: Alarm gateway infrared detection alarm; 92: Alarm gateway low battery alarm; 93: Alarm gateway tampering alarm |
| alarms.deviceId | String | Device ID |
| alarms.picurlArray | String[] | Alarm picture url |
| alarms.thumbUrl | String | Thumbnail Url |
| nextAlarmId | Long | The message Id of the last message in the current message list |
Sample output
{
"result":{
"msg":"The operation was successful",
"code":"0",
"data":{
"alarms":[
{
"alarmId":"1726360834259136",
"name":"TP1S-1842",
"time":1603350842,
"localDate":"2020-10-22 15:14:02",
"type":"1",
"thumbUrl":"https://storage.example.com/alarm/07540ab39e82488490b232977c333c9e_0_thumb.dav?Expires=1603437367&AccessKeyId=EXAMPLE&Signature=EXAMPLE",
"deviceId":"TESTQWERXXXX",
"picurlArray":[
"https://storage.example.com/alarm/07540ab39e82488490b232977c333c9e_0.jpg?Expires=1603437367&AccessKeyId=EXAMPLE&Signature=EXAMPLE"
],
"channelId":"0",
"token":"07540ab39e82488490b232977c333c9e"
},
{
"alarmId":"1726360340019392",
"name":"TP1S-1842",
"time":1603350721,
"localDate":"2020-10-22 15:12:01",
"type":"1",
"thumbUrl":"https://storage.example.com/alarm/ccea3589e6484646b0bc9f97f45dd8c5_0_thumb.dav?Expires=1603437367&AccessKeyId=EXAMPLE&Signature=EXAMPLE",
"deviceId":"TESTQWERXXXX",
"picurlArray":[
"https://storage.example.com/alarm/ccea3589e6484646b0bc9f97f45dd8c5_0.jpg?Expires=1603437367&AccessKeyId=EXAMPLE&Signature=EXAMPLE"
],
"channelId":"0",
"token":"ccea3589e6484646b0bc9f97f45dd8c5"
}
],
"count":2,
"nextAlarmId":1726360340019392
}
},
"id":"9f05aa70-91fd-4d35-8b06-cd2ece55346b"
}
Error codes
This method may return the codes below. See Return codes and Capability errors for the full catalog.
Gateway and auth (SN / TK / OP)
| Code | Meaning | Next step |
|---|---|---|
SN1001 | Signature error | Check sign per Development specification |
TK1002 | Token invalid or expired | Refresh accessToken |
OP1002 | Missing required parameter | Add required fields |
OP1003 | Invalid parameter | Match this page’s parameter table |
OP1009 | Permission denied | Check token and device bind/share grants |
OP1013 | Total call limit exceeded | Reduce call rate |
OP1014 | Daily per-interface limit exceeded | See Interface call limits |
DV1007 | Device offline | Wait until the device is online |
See Return codes · OP/SN/TK for the full catalog.
Sub-accounts (SUB)
| Code | Meaning | Next step |
|---|---|---|
SUB1001–SUB1002 | Sub-account lacks API permission | Update policy via addPolicy |
SUB1005 | Sub-account token expired | Refresh subAccountToken |
SUB1006 | No device grant for sub-account | Check Resource and device serial |
SUB1008 | Sub-account not bound to app | Create and bind the sub-account first |
See Return codes · SUB.
Device access and channels (DV10xx)
| Code | Meaning | Next step |
|---|---|---|
DV1007 | Device offline or timeout | Wait for the device to come online |
DV1009 | Device busy | Retry later |
DV1012 | Insufficient share/grant permission | Check sub-account Permission / Resource |
DV1019 | Capability not supported | Confirm model and capability list |
DV1020 | Channel offline | Check channel status |
DV1026 | Function not supported | Use another API or upgrade firmware |
DV1028 | Not bound or channel missing | Verify deviceId / channelId |
See Return codes · DV.
