device.message.list(接收告警)
device.message.list:接收告警
与能力版 接收告警(g04) 同步维护(permalink 不同)。本页是实时推送。事后翻、删见 查询告警历史、按类型检索告警、查询单条告警、删除告警。未开启动检或设备撤防时可能没有数据,先按 能力使用 · 先跑通一次 打开动检。
| 方式 | 接口 | 类型名 |
|---|---|---|
| 实时推送 | 设置回调 | 订阅 capabilityEvent 后,msgType 如 detection.motion.detected |
| 主动查询 | device.message.list / search / detail / delete | 返回里的 msgType 与推送相同 |
实时推送
- 用 setMessageCallback 配置回调 URL。
callbackFlag增加capabilityEvent(可与alarm、deviceStatus等逗号分隔)。- 回调 HTTP body 是下面这条上报报文,与
pullMessages的msgBody相同。须返回 HTTP 200。签名与探活见 推送配置 与 配置平台消息推送。
订阅 capabilityEvent 之后,能力事件的 msgType 如 detection.motion.detected,属性变化上报为 device.property.report。查询返回还有 count / nextAlarmId,不要和本页这条上报报文当成同一种 JSON。
动检这类侦测告警一般会带缩略图、告警图,有联动云录像时还有 token。开通智见云存储或 AI 智见套餐时才会出现 aiCopyWriting / securityRiskLevel / aiTag,没有则字段不出现。本报文没有 feedback(历史查询才有)。
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
msgType | String | 等于 eventId,如 detection.motion.detected |
deviceId | String | 设备序列号 |
productId | String | 型号 |
channelId | String | 通道级事件返回;设备级不返回 |
outputData | Object | 该事件自己的字段。没有则为 {}。各事件页只写这一段 |
time | Int | 上报时间,Unix 秒 |
localTime | String | 设备本地 yyyyMMddTHHmmss |
alarmId | String | 告警 id,用于 detail / delete / 翻页 |
token | String | 联动云录像时出现,用来调现网云录像接口 |
thumbUrl | String | 缩略图,可当封面。有图才返回 |
picUrlArray | Array | 告警图,可做动效。有时效,尽快转存 |
labelType | String | 消息类型标签 |
aiCopyWriting | String | 智见文案。开通智见云存储或 AI 智见套餐时才有 |
securityRiskLevel | Int | 安全风险等级,1~10。开通智见才有 |
aiTag | Array | 智见标签,如人、车、宠物、包裹。开通智见才有 |
{
"msgType": "detection.motion.detected",
"deviceId": "TESTIPC000012345",
"productId": "56WGTET2",
"channelId": "0",
"outputData": {
"extendContext": {
"handleBit": 1
}
},
"time": 1673406989,
"localTime": "20230111T111629",
"alarmId": "116257862023505xxxx",
"token": "f2dc8c09eeae4b5bad6abf522c93d825",
"thumbUrl": "https://example.imou.com/pic/thumb.jpg",
"picUrlArray": [
"https://example.imou.com/pic/frame1.jpg",
"https://example.imou.com/pic/frame2.jpg"
],
"labelType": "humanAlarm",
"aiCopyWriting": "穿黑衣服的男子从门店骑车经过",
"securityRiskLevel": 1,
"aiTag": ["人", "车"]
}
主动查询
POST https://openapi.lechange.cn/openapi/v2/device.message.list,字段见 查询告警历史。
beginTime / endTime 是设备本地 yyyyMMddTHHmmss,例如 20201022T000000。
{
"id": "d5c287b4-5b2f-4f03-baf5-8032c5c354af",
"system": {
"ver": "1.0",
"appId": "lcdxxxxxxxxx",
"sign": "xjhCQBoJ9hRDsCjyDcHjtDNzRZ3ZJezcawsfWeiaoxU=",
"time": 1706511734,
"nonce": "f5a1ae2d-c09c-4d39-a744-83a5c2c653c2"
},
"params": {
"token": "<yourAccessToken>",
"deviceId": "TESTIPC000012345",
"channelId": "0",
"beginTime": "20201022T000000",
"endTime": "20201022T235959",
"nextAlarmId": "-1"
}
}
返回 messages[]。能力事件的 msgType 等于 eventId。用 nextAlarmId 翻页。按类型检索用 按类型检索告警。单条用 查询单条告警。删除用 删除告警。
无权事件在 list / search 中直接过滤,不整单 DV2011。