Send command to device

PUT/devices/{deviceId}/command

Base URL: https://api.tinkermode.com

Issue a command to the specified device. If the device is offline, the command will not be sent, and an HTTP status 503 will be returned.

Authentication

Send an Authorization header of the form ModeCloud <AUTH_CODE>.

Must contain a user, service account, or project API key.

Path parameters

NameTypeRequiredConstraintsDescription
deviceIdintegerYesDevice ID

Request body

Content type: application/json

PropertyTypeRequiredConstraintsDescription
actionstringYespattern: ^[0-9a-z][0-9a-z_\-]+[0-9a-z]$Action to be taken by device.
parametersobjectNoAction-specific parameters. This is opaque to the cloud service.

Request example

{
  "action": "sprinkler-on",
  "parameters": {
    "duration": 120,
    "zone": 2
  }
}

Responses

204 Successfully sent a command to device. There is no return body.

401 Authorization is required to access this resource.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

403 Request failed because of invalid data or denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

404 The requested command does not exist or is not accessible.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 Command is not sent, either because of a temporary service failure, or because the device is currently offline. Inspect the "reason" field of the response body to determine the cause of the failure.