Discover farm servers
POSTfarm-server-list
Read farm servers, IoT device inventory, irrigation status, and operation history.
Build an irrigation dashboard. Discover the farm server and devices, show which readings are current, and reconcile command acknowledgement against operation logs and device state.
Compatibility. Service support varies by device type. Inventory and batch status cover electric valves and smart switches. Check the device type table for controllers and attachments. Treat long farm and scene IDs as strings.
POST /open/service
serviceName=farm-device-list
Obtain org_id from your authorized farm and the server serial through farm-server-list. Check lastTime before treating the returned device state as current.
Set XAG_APP_UID and XAG_APP_SECRET in your server environment. Substitute the sample IDs with authorized values.
# 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-list' \
--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",
"pageNo": 1,
"pageSize": 20
}'{
"status": 200,
"success": true,
"data": [
{
"deviceId": "example-valve",
"device_name": "Example valve",
"model_type": 16,
"lastTime": 1788200000
}
]
}All services use /open/service with the common signed query parameters. Additional fields are listed below. Open an operation for its parameters, examples and response notes.
POSTfarm-server-list
POSTfarm-device-list
Required service parametersorg_id, fs_sn, pageNo, pageSize
Cache deviceId and model_type for follow-up reads.
View operationPOSTfarm-device-operate-log
Required service parametersorg_id, fs_sn, beginTimeStamp, endTimeStamp, pageNo, pageSize
Use Unix seconds. Status 103 is receipt acknowledged, while 108 indicates a callback was received.
View operationPOSTfarm-device-status-log
Required service parametersorg_id, fs_sn, deviceId, model_type, date
Use YYYYMMDD and query one day at a time.
View operationPOSTfarm-info-list
Required service parametersorg_id, fs_sn, modules
The default module list is ["facility"]. Optional time bounds are seconds.
View operationRequired service parametersorg_id, fs_sn, device_id, model_type, action_name, params
The command and parameters depend on the hardware. Confirm execution using the command log and device state.
View operationPOSTfarm-device-real-time-status
Required service parametersorg_id, fs_sn, deviceId, model_type
Interpret readings using the device model table and timestamp.
View operationPOSTfarm-benefit-info
Required service parametersorg_id
Use this to inspect benefits associated with the farm account.
View operationRequired service parametersorg_id, fs_sn, device_type, work_model
Applies by device type. Use 1 for smart wake or 2 for fast wake.
View operationPOSTfarm-device-work-model
Required service parametersorg_id, fs_sn, device_type
Read the current setting before planning a change.
View operationPOSTfarm-device-smart-list
Required service parametersorg_id, fs_sn, page_no, page_size, type
Choose the documented scene type. The scene property schema depends on that type.
View operationPOSTfarm-device-smart-detail
Required service parametersorg_id, fs_sn, control_type, scene_id
Some irrigation starts require extent with a level device and a water-level or duration target. Match the parameters to the selected control type.
View operationRequired service parametersorg_id, fs_sn, device_id, oper_id
Use the operation ID from the log. Recheck device state after cancellation.
View operationPOSTfarm-batch-get-device
Required service parametersorg_id, fs_sn, deviceIds
Send deviceIds as a list of the identifiers returned by device discovery.
View operation