Sending commands through REST API

Asset Tracker Template

tags
Asset Tracker Template

Send device commands by updating the device shadow, using the same endpoint and environment variables as in Configuration through REST API:

curl -X PATCH "$BASE/long-range/devices/$DEVICE_ID/state" \
  -H "Authorization: Bearer $NRFCLOUD_OAT" \
  -H "Content-Type: application/json" \
  -d '{"desired": {"command": [1, 1]}}'

The command format is "command": [type, id], where the two fields have the following meanings:

  • type: The command type. The only valid value is 1, which triggers provisioning.
  • id: A unique identifier that you increment for successive commands. The valid range is 1 to 4294967295, which excludes 0.

For more information about the shadow structure, see Asset-Tracker-Template/app/src/cbor/device_shadow.cddl.