Receive Device Reports

Source document: GS_GE Device Integration Documentation V1.0.7

The developer must provide an HTTPS callback API to receive device reports.

Request Method

POST

Request Fields

Field Description
device_id Unique Device ID; provide at least one of device_id and IMEI
IMEI International Mobile Equipment Identity (IMEI)
timestamp Timestamp
nonce Random string, 8-12 characters
sign Signature Verification Field
data Device report data is represented as a string in actual reports

Request Example

Code Example
{
  "device_id": "DeviceID",
  "IMEI": "DEMO_IMEI_001",
  "timestamp": 112789023833,
  "nonce": "<YOUR_NONCE>",
  "sign": "<YOUR_SIGN>",
  "data": "{\"source\":\"guard\",\"dest\":\"4g-smoke-sense-camera\",\"cmd\":\"stop_alarm\",\"device_id\":\"testxxxxx001\",\"cmd_time\":\"2024-01-01 00:00:00\"}"
}

The actual reported data in the data field is represented as a string. Convert it to JSON and parse it according to the event type. After parsing, GS/GE events are primarily distinguished by origin_info; the other common fields are broadly the same.

Sign Generation Rules

Parameters Value
DID Pass device_id
IMEI Do not pass
vpOpenID Pass appid
timestamp Pass the outer timestamp
nonce Pass the outer nonce
data Pass the data string from this message
secretKey Pass secret_key

origin_info.did is the Device ID; use the outer device_id field for now because this field will be removed later. mode=event indicates an event, and mode=alarm indicates an alarm. send_time and the outer timestamp represent the same report time; send_time will be removed later.

After receiving a message, it is recommended to enqueue it in an internal MQ consumer and then respond to the callback API promptly.

Response Fields

Return value on successful receipt:

Code Example
{ "ret": "ok" }

Returned on reception failure, or omitted:

Code Example
{ "ret": "error" }

curl Example

Code Example
curl -XPOST 'https://开发者提供的回调地址' \
  -H 'content-type: application/json;charset=UTF-8' \
  -H 'AppID: <YOUR_APP_ID>' \
  --data-raw '{
    "device_id": "DeviceID",
    "IMEI": "DEMO_IMEI_001",
    "timestamp": 112789023833,
    "nonce": "kjhZausd1",
    "sign": "<YOUR_SIGN>",
    "data": "{\"source\":\"guard\",\"dest\":\"4g-smoke-sense-camera\",\"cmd\":\"stop_alarm\",\"device_id\":\"testxxxxx001\",\"cmd_time\":\"2024-01-01 00:00:00\"}"
  }'