Device Connectivity Made Easy

Focus on your product and innovation and leave communication and management to DeviceHive.

Get Started

DeviceCommand

Represents a device command, a unit of information sent to devices.

Methods

Method

Authorization

Uri

Description

query

Access JSON Web Token (GetDeviceCommand)

GET /device/{deviceId}/command

Queries device commands.

get

Access JSON Web Token (GetDeviceCommand)

GET /device/{deviceId}/command/{commandId}

Gets information about device command.

insert

Access JSON Web Token (CreateDeviceCommand)

POST /device/{deviceId}/command

Creates new device command.

update

Access JSON Web Token (UpdateDeviceCommand)

PUT /device/{deviceId}/command/{commandId}

Updates an existing device command.

poll

Access JSON Web Token (GetDeviceCommand)

GET /device/{deviceId}/command/{commandId}/poll

Polls new device commands.
This method returns all device commands that were created after specified timestamp.
In the case when no commands were found, the method blocks until new command is received. If no commands are received within the waitTimeout period, the server returns an empty response. In this case, to continue polling, the client should repeat the call with the same timestamp value.

wait

Access JSON Web Token (GetDeviceCommand)

GET /device/{deviceId}/command/{commandId}/poll

Waits for a command to be processed.
This method returns a command only if it has been processed by a device.
In the case when command is not processed, the method blocks until device acknowledges command execution. If the command is not processed within the waitTimeout period, the server returns an empty response. In this case, to continue polling, the client should repeat the call.

pollMany

Access JSON Web Token (GetDeviceCommand)

GET /device/command/poll

Polls new device commands.
This method returns all device commands that were created after specified timestamp.
In the case when no commands were found, the method blocks until new command is received. If no commands are received within the waitTimeout period, the server returns an empty response. In this case, to continue polling, the client should repeat the call with the same timestamp value.

Resource Representation

{
    "id": {integer},
    "timestamp": {datetime},
    "userId": {integer},
    "deviceId": {string},
    "networkId": {integer},
    "deviceTypeId": {integer},
    "command": {string},
    "parameters": {object},
    "lifetime": {integer},
    "status": {string},
    "result": {object},
    "lastUpdated": {datetime}
}

Property Name

Type

Description

id

integer

Command identifier.

command

string

Command name

timestamp

datetime

Command UTC datetime (yyyy-MM-dd'T'HH:mm:ss.SSS ISO 8601).

userId

integer

Associated user identifier.

deviceId

string

Device unique identifier.

networkId

integer

Network unique identifier.

deviceTypeId

integer

Device type unique identifier.

parameters

object

Command parameters, a JSON object with an arbitrary structure.

lifetime

integer

Command lifetime, a number of seconds until this command expires.

status

string

Command status, as reported by device or related infrastructure.

result

object

Command execution result, an optional value that could be provided by device.

lastUpdated

datetime

Last command update UTC datetime (yyyy-MM-dd'T'HH:mm:ss.SSS ISO 8601).

Updated 3 years ago

DeviceCommand


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.