Home / Docs Center / Platform API / Device Online Status

Device Online Status

Platform API · Self-hosted Cloud Integration

/third/product/online — Device Online Status Query

Basic Information

Item Description
Path /third/product/online
Method GET / POST
Authentication Third authentication (token + t, see the signature algorithm below)

Authentication Parameters (Required in Query)

Parameters Type Required Description
t int64 Yes Current Unix timestamp (seconds). It must not differ from the server time by more than 2 hours, otherwise {"code":400,"msg":"请求已过期"}
token string Yes Request for signature, calculated by secret + all Query parameters (see lower signature algorithm), verification failed to return {"code":401,"msg":"非法请求"}

Signing algorithm

Signature Algorithm

  1. All Query parameters (including productId, t and so on) plus secret make up the key/value set
  2. In alphabetical order, sort all the keys
  3. Concatenate them into a string of the form key1=value1&key2=value2&... (no URL encoding: the raw values are used directly)
  4. Run MD5 over that string; the result is the token

⚠️ secret is only used to compute the signature — it must never appear directly in request parameters.


1. Single product status query

Request

GET /third/product/online?productId=SN001&t=1750262400&token=abc123def456
Parameters Location Type Required Description
productId Query string Yes Product serial number
t Query int64 Yes Current Unix timestamp (seconds)
token Query string Yes Signature

Response

{ "status": 1 }
Field Type Description
status int32 1 = Online0 = Offline

2. Batch product status query

2. Batch Product Status Query productId Reads the Body content for bulk queries when you are empty. Required POST method, and the signature parameters still go in the Query.

Request

POST /third/product/online?t=1750262400&token=abc123def456

Body: SN001,SN002,SN003
Parameters Location Type Required Description
t Query int64 Yes Current Unix timestamp (seconds)
token Query string Yes Signature (based on all Query parameters)
— Body string Yes Comma-separated list of serial numbers

Response

{
  "SN001": 1,
  "SN002": 0,
  "SN003": 1
}
Field Type Description
{key} int32 key is the serial number1 = Online0 = Offline

Edge cases

Scenario Response
Body, empty {}
Serial number contains back and forth spaces Automatic TrimSpace
Empty string from a continuous comma Skip

Example of Signing Calculating (False Code)

// 假设 secret = "e10adc3949ba59abbe56e057f20f883e"
// 请求参数: productId=SN001, t=1750262400

params := url.Values{
    "productId": {"SN001"},
    "t":         {"1750262400"},
    "secret":    {"e10adc3949ba59abbe56e057f20f883e"},  // 仅参与计算,不发送
}

// 按 key 字母序拼接: productId=SN001&secret=e10ad...&t=1750262400
str := "productId=SN001&secret=e10adc3949ba59abbe56e057f20f883e&t=1750262400"

token = MD5(str)  // → 签名结果

Example call (curl)

Single query:

# 1. 计算 token(需自行实现签名逻辑)
TIMESTAMP=$(date +%s)
# token = MD5("productId=SN001&secret=${SECRET}&t=${TIMESTAMP}")

curl "http://host:port/third/product/online?productId=SN001&t=${TIMESTAMP}&token=${TOKEN}"

Batch query:

curl -X POST \
  "http://host:port/third/product/online?t=${TIMESTAMP}&token=${TOKEN}" \
  -d "SN001,SN002,SN003"
Device Information Query , talk to our engineers directly.
Didn't find what you need?Contact us, talk to our engineers directly.

Request a Quote

Fill in the form and we will get back with a quote and proposal within 1 business day.

Click "Generate inquiry email" to open your mail client with the body pre-filled. If no mail client is configured, click "Copy" and paste it into webmail — recipient: sunshiyang@xstrive.com.