Sending Downlinks
You can command devices over the API too. A downlink is queued and delivered
the next time the device boots, sends an uplink, or polls the Cloud — so the
response may not be immediate (see Downlink). There are three
kinds, each with its own endpoint under /v2/spaces/{space_id}/devices/{device_id}:
- Config
- Shell command
- Data
POST …/devices/{device_id}/configs — body is a JSON array of app config
commands:
curl -X POST \
-H 'X-API-KEY: <api-key>' \
-H 'Content-Type: application/json' \
'https://api.hardwario.cloud/v2/spaces/<space-id>/devices/<device-id>/configs' \
-d '["app config interval-report 1800", "app config interval-sample 60"]'
Do not send
config saveThe Cloud applies and saves configuration automatically. Adding config save
yourself can double-apply the change — omit it.
POST …/devices/{device_id}/commands — body is a JSON array of shell commands;
you'll get each command's response back on the message:
curl -X POST \
-H 'X-API-KEY: <api-key>' \
-H 'Content-Type: application/json' \
'https://api.hardwario.cloud/v2/spaces/<space-id>/devices/<device-id>/commands' \
-d '["info show", "app config show"]'
POST …/devices/{device_id}/downlinks — body is a JSON object that your device
firmware decodes:
curl -X POST \
-H 'X-API-KEY: <api-key>' \
-H 'Content-Type: application/json' \
'https://api.hardwario.cloud/v2/spaces/<space-id>/devices/<device-id>/downlinks' \
-d '{ "relay": true, "setpoint": 21.5 }'