command/subscribe

Subscribes to device commands. After subscription is completed, the server will start to send command/insert messages to the connected user.

Authorization

Access JSON Web Token (GetDeviceCommand)

Request Topic and Payload

Topic

dh/request

Payload Representation

{
    "action": {string},
    "requestId": {object},
    "timestamp": {datetime},
    "deviceId": {string},
    "networkIds": {array},
    "deviceTypeIds": {array},
    "returnUpdatedCommands": {boolean},
    "names": {array}
    "limit": {integer}
}

Payload Parameters

Property NameRequiredTypeDescription
actionYesstringAction name: command/subscribe
requestIdNoobjectRequest unique identifier, will be passed back in the response message.
timestampNodatetimeUTC datetime (yyyy-MM-dd'T'HH:mm:ss.SSS ISO 8601) of the last received command. If not specified, the server's timestamp is taken instead.
deviceIdNostringA unique device identifier to subscribe to. If not specified, the subscription is made to all accessible devices.
networkIdsNoarrayArray of network unique identifiers to subscribe to.
deviceTypeIdsNoarrayArray of device type unique identifiers to subscribe to.
returnUpdatedCommandsNobooleanChecks if updated commands should be returned. If not specified, default value is false.
namesNoarrayArray of command names to subscribe to.
limitNoobjectLimits the number of commands for a subscription.

Response Topic and Payload

Topic

dh/response/command/subscribe@{clientId}

Payload Representation

{
    "action": {string},
    "status": {string},
    "requestId": {object},
    "subscriptionId": {long}
}

Payload Parameters

Property NameTypeDescription
actionstringAction name: command/subscribe
statusstringOperation execution status (success or error).
requestIdobjectRequest unique identifier as specified in the request message.
subscriptionIdlongA unique identifier of the subscription made.