MQTT API Commands
This section provides examples of the MQTT API commands supported by the device. For how to configure MQTT API parameters, refer to Configure MQTT API Parameters (Cellular Version Only).
Search Report Commands
{
"dst": "all",
"type":0,
"command":"/api/v1/system/searchReport",
"msgId":"1",
"requestData":{
"event":0,
"startTime":"2025-01-22T08:00:00.000",
"endTime":"2025-01-23T08:00:00.000",
"lineParam":{
"lineId":0,
"timeUnit":0,
"mode":0
},
"regionCount":{
"regionId":0
},
"dwellDetect":{
"regionId":0,
"timeMin":10,
"timeBinWidth":10,
"numOfBins":10
},
"heatMap":{
"type":0
},
"uuid":"1d4f62b5-37f0-4bda-80f8-a5625613fc6e"
}
}For request example parameter descriptions, refer to the following table.
| Parameter | Type | Description |
|---|---|---|
| dst | string |
all: Send to all recipients that subscribe the MQTT API topic. SN: Send to a certain recipient. |
| type | number | 0: Request, 1: Response. |
| msgId | number | Request identifier. |
| requestData | object | |
| event | number |
0: Line crossing counting 1: Region people counting 2: Dwell time detection 3: Heat map 4: History Point |
| startTime | ||
| endTime | ||
| lineParam | ||
| regionCount | ||
| dwellDetect | ||
| heatMap | ||
| uuid | string | Random unique ID defined by the user |
Response example: Success
{
"code":0,
"message":"ok",
"msgId":"1",
"src":"6834E16184430017",
"transmitTime":2,
"type":1
}
For response example parameter descriptions, refer to the following table.
| Parameter | Type | Description |
|---|---|---|
| code | integer | |
| message | string | |
| msgId | number | Response identifier |
| src | string | Response SN |
| type | number | 0: Request, 1: Response |
Get Report Result Commands
Request example:
{
"dst": "all",
"type":0,
"command":"/api/v1/system/getReportResult",
"msgId":"1",
"requestData":{
"uuid":"1d4f62b5-37f0-4bda-80f8-a5625613fc6e",
"event":0
}
}
For request example parameter descriptions, refer to the following table.
| Parameter | Type | Description |
|---|---|---|
| dst | string |
all: Send to all recipients that subscribe the MQTT API topic. SN: Send to a certain recipient. |
| type | number | 0: request, 1: response. |
| msgId | number | Request identifier. |
| requestData | object | |
| uuid | string | Random unique ID defined by the user. |
| event | number |
0: Line crossing counting. 1: Region people counting. 2: Dwell time detection. 3: Heat map. |
Response example:
{
"code": 0,
"data": {
"event": 0,
"isReady": true,
"line": [
{
"children": {
"femaleIn": 0,
"femaleOut": 1,
"in": 6,
"maleIn": 6,
"maleOut": 0,
"out": 1
},
"group": {
"in": 9,
"out": 3
},
"staff": {
"femaleIn": 0,
"femaleOut": 0,
"in": 0,
"maleIn": 0,
"maleOut": 0,
"out": 0
},
"time": "2024-08-15T09:00:00.000",
"total": {
"femaleIn": 0,
"femaleOut": 1,
"in": 9,
"maleIn": 9,
"maleOut": 2,
"out": 3
}
}
]
},
"message": "ok",
"transmitTime": 1
}
For response example parameter descriptions, refer to the following table.
| Parameter | Type | Description |
|---|---|---|
| code | integer | |
| data | object [] | Return data |
| event | number |
0: Line crossing counting 1: Region people counting 2: Dwell time detection 3: Heat map |
| isReady | boolean | |
| line,region | object | Including children, staff, group, total |
| children, staff,group ,dwell , total | object | Including in, out, femaleIn, femaleOut, maleIn, maleOut |
| heatmap | object | |
| height | number | Height of the heatmap data grid |
| width | number | Width of the heatmap data grid |
| max | number | Maximum value of heat map |
| min | number | Minimum value of heat map |
| values | object[] | |
| X | number | |
| Y | number | |
| value | number | |
| historyPoints | ||
| values | object[] |
Trajectory point types: 0: Start trajectory point 1: Stop trajectory point |
| X | number | |
| Y | number | |
| message | string | Return information |
| transmitTime | number | Processing time |
Search Log Commands
{
"dst":"all",
"type":0,
"command": "/api/v1/system/searchLog",
"msgId":12345678,
"requestData":{
"startTime": "0",
"endTime": "1800211081920",
"logType": 0,
"admin": true
}
}For request example parameter descriptions, refer to the following table.
| Parameter | Type | Description |
|---|---|---|
| dst | string |
all: Send to all recipients that subscribe the MQTT API topic. SN: Send to a certain recipient. |
| type | number | 0: Request, 1: Response. |
| msgId | number | Request identifier. |
| requestData | object | |
| startTime | string | Start timestamp. Unit: ms. |
| endTime | string | End timestamp. Unit: ms. |
| logType | number | 0: Starting up log. |
| admin | boolean |
true: Display response parameter rebootCode. false: Hide response parameter rebootCode. |
{
"code": 0,
"data": {
"log": [
{
"PowerOnTime": "2024-07-22T09:34:27+08:00",
"ShutdownTime": "2024-07-22T09:41:59+08:00",
"rebootCode": 1,
"rebootMessage": "normal",
"runningTime": 451
},
{
"PowerOnTime": "2024-07-22T09:42:05+08:00",
"ShutdownTime": "2024-07-22T09:54:47+08:00",
"rebootCode": 3,
"rebootMessage": "upgrade success",
"runningTime": 761
}
],
"recordCount": 5
},
"message": "ok",
"transmitTime": 3
}For response example parameter descriptions, refer to the following table.
| Parameter | Type | Description |
|---|---|---|
| code | integer | |
| data | object | |
| log | object[] | Item type: object |
| PowerOnTime | string | Boot time |
| ShutdownTime | string | Power outage time |
| rebootCode | string |
-1: Running 0: Unknown reason reboot 1: Manual reboot 2: Network modification reboot 3: Web upgrade reboot 4: Software reset reboot 5: Hardware reset reboot 6: Configuration import reboot 7: Remote management configuration import 8: Remote management upgrade 9: Upgrade failure reboot 10: Multicast network configuration modification reboot 11: mssserver crash 12: avserver crash 13: lighttpd crash 14: Multi-device stitching mode change 15: Multiple 4G dial-up failures |
| runningTime | integer | |
| runningTime | string | |
| recordCount | integer | Number of restarts. Maximum display 1000. |
| message | string | |
| transmitTime | number | Processing time |