Browse developer docs
Read the command log
POSTfarm-device-operate-log
Request
Send POST to /open/service with serviceName=farm-device-operate-log and the common signing parameters.
Send extra fields in the JSON body
Use Unix seconds. Status 103 is receipt acknowledged, while 108 indicates a callback was received.
Request example
# Requires curl 7.87+, Python 3 and OpenSSL.
: "${XAG_APP_UID:?Set XAG_APP_UID}"
: "${XAG_APP_SECRET:?Set XAG_APP_SECRET}"
timestamp=$(python3 -c 'import time; print(time.time_ns() // 1000000)')
token=$(printf "%s" "$XAG_APP_UID$timestamp$XAG_APP_SECRET" | openssl dgst -sha1 -r | cut -d " " -f 1)
curl --silent --show-error --fail-with-body --max-time 30 --request POST \
'https://open.xa.com/open/service' \
--url-query 'serviceName=farm-device-operate-log' \
--url-query "appUid=$XAG_APP_UID" \
--url-query "timestamp=$timestamp" \
--url-query "token=$token" \
--header 'Content-Type: application/json' \
--data '{
"org_id": "YOUR_FARM_ID",
"fs_sn": "YOUR_FARM_SERVER_SN",
"beginTimeStamp": 1788200000,
"endTimeStamp": 1788203600,
"pageNo": 1,
"pageSize": 20
}'| Parameter | Requirement | Meaning |
|---|---|---|
org_id | Required | Authorized farm or organization ID. |
fs_sn | Required | Farm server serial from farm-server-list. |
device_id | Optional | Device ID from the inventory. |
operateId | Optional | Filter to a particular command-log record. |
status | Optional | Command-state filter. Separate multiple state codes with a vertical bar. |
beginTimeStamp | Required | Beginning of the operation-log range in Unix seconds. |
endTimeStamp | Required | End of the operation-log range in Unix seconds. |
pageNo | Required | Page number, starting at 1. |
pageSize | Required | Number of records per page. |
Response
The log tracks command progress. A receipt acknowledgement (103) can precede the execution callback (108).
Show example response fields and types
{
"success": "boolean",
"status": "number",
"message": "string",
"data": [
{
"device_id": "string",
"oper_id": "number",
"model_type": "number",
"push_time": "number",
"result_time": "number",
"status": "number",
"action_type": "string",
"result_code": "number"
}
]
}