Home / Docs Center / Platform API / Device Online Status
Device Online Status
/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
- All Query parameters (including
productId,tand so on) plussecretmake up the key/value set - In alphabetical order, sort all the keys
- Concatenate them into a string of the form
key1=value1&key2=value2&...(no URL encoding: the raw values are used directly) - Run MD5 over that string; the result is the
token
⚠️
secretis 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
productIdReads 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"
Didn't find what you need?Contact us, talk to our engineers directly.