Browse developer docs
Submit an IoT command
POSTfarm-device-action
Request
Send POST to /open/service with serviceName=farm-device-action and the common signing parameters.
Send extra fields in the JSON body
The command and parameters depend on the hardware. Confirm execution using the command log and device state.
This operation submits a change. Replace the illustrative values, confirm access, and review the intended action before sending a signed request.
Illustrative payload
{
"org_id": "YOUR_FARM_ID",
"fs_sn": "YOUR_FARM_SERVER_SN",
"device_id": "YOUR_DEVICE_ID",
"model_type": 16,
"action_name": "<supported command>",
"params": {}
}| Parameter | Requirement | Meaning |
|---|---|---|
org_id | Required | Authorized farm or organization ID. |
fs_sn | Required | Farm server serial from farm-server-list. |
device_id | Required | Device ID from the inventory. |
model_type | Required | IoT hardware type identifier. |
action_name | Required | Command identifier for the installed equipment. |
params | Required | Model-specific command argument object. |
params.open_status1 | Conditional | Opening percentage for a valve port. Use open_statusN for the selected port and set only one port per request. |
params.switch | Conditional | Switch state, with 1 for on and 2 for off. |
params.target_frequency | Conditional | Target inverter frequency in Hz for supported controllers. |
params.ratio | Conditional | Gate opening percentage for a supported flood-irrigation gate. |
Response
Reconcile the command through the operation log and verify the observed hardware state. The example object leaves device-specific command parameters for the integrator.
Show example response fields and types
{
"status": "number",
"data": {
"operId": "number"
},
"message": "string"
}