Home / Docs Center / Platform API / Device Online Status

Device Online Status

Platform API · Self-hosted Cloud Integration

Project: Platform API | page_id: 162

/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)

Parameter 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":"Request expired"} is returned.
token string Yes Request signature, calculated from secret + all Query parameters (see the signature algorithm below). If verification fails, {"code":401,"msg":"Illegal request"} is returned.

Signature Algorithm

Calculation steps:

  1. Put all Query parameters (including productId, t, etc.) together with secret into a key-value set.
  2. Sort all keys in alphabetical order.
  3. Concatenate them into a string in the format key1=value1&key2=value2&... (note: no URL encoding; the raw values are used directly).
  4. Take the MD5 of that string; the result is the token.

⚠️ secret only participates in signature calculation and must not appear in the request parameters.


1. Single Product Status Query

Request

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

Response

{ "status": 1 }
Field Type Description
status int32 1 = online, 0 = offline

2. Batch Product Status Query

When productId is empty, the Body content is read for a batch query. The POST method must be used, and the signature parameters must still be placed in the Query.

Request

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

Body: SN001,SN002,SN003
Parameter Location Type Required Description
t Query int64 Yes Current Unix timestamp in seconds
token Query string Yes Signature (calculated from 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 number, 1 = online, 0 = offline

Edge Cases

Scenario Response
Body is empty {}
Serial numbers with leading/trailing spaces Automatically TrimSpace
Empty strings produced by consecutive commas Skipped

Signature Calculation Example (pseudo code)

// Assume secret = "e10adc3949ba59abbe56e057f20f883e"
// Request parameters: productId=SN001, t=1750262400

params := url.Values{
    "productId": {"SN001"},
    "t":         {"1750262400"},
    "secret":    {"e10adc3949ba59abbe56e057f20f883e"},  // only used for calculation, not sent
}

// Concatenate in alphabetical key order: productId=SN001&secret=e10ad...&t=1750262400
str := "productId=SN001&secret=e10adc3949ba59abbe56e057f20f883e&t=1750262400"

token = MD5(str)  // → signature result

Call Examples (curl)

Single query:

# 1. Calculate the token (you need to implement the signature logic yourself)
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.

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.