Skip to main content

Execute Command

Besides reading device's information telemetry, HTTP API also allows you to run device commands. Method commands/v1/execute allows to run command on device. See method reference to get full information.

Let's request execution of ping command on the device 123e4567-e89b-12d3-a456-426614174000:

$ curl http://enapter-gateway.local/api/commands/v1/execute -X POST \
-H 'X-Enapter-Auth-Token: {ACCESS_TOKEN}' \
-d '{"device_id": "123e4567-e89b-12d3-a456-426614174000", "command_name": "ping"}'

You should get a success response containing command state and a payload:

{
"state": "succeeded",
"payload": {
"value": "pong"
}
}

Note that command execution (and hence the HTTP request) might take some time.

All Rights Reserved © 2024 Enapter AG.