Send device event to cloud

PUT/devices/{deviceId}/event

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

Send a device event to the cloud, which propagates the event to the other relevant listeners. Only the corresponding device itself can make this call.

Authentication

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

Must contain API key of the matching device.

Path parameters

NameTypeRequiredConstraintsDescription
deviceIdintegerYesDevice ID

Request body

Content type: application/json

PropertyTypeRequiredConstraintsDescription
eventDataobjectYesEvent-specific data as a JSON hash. Opaque to the cloud service.
eventTypestringYespattern: ^[a-zA-Z](?:[\-_]?[a-zA-Z0-9]+)*$Event type ID. Must begin 1 or more alpha characters; dashes ('-') and underscores ('_') may be used after the first character but must be followed by 1+ alphanumeric characters.
homeIdintegerNoread-only (server-generated)ID of the home associated with this event. MODE adds this at event delivery to listeners. Devices don't need to add this.
originDeviceClassstringNoread-only (server-generated)If the event originates from a device, this property is the device's class ID. MODE adds this at event delivery to listener.
originDeviceIdintegerNoread-only (server-generated)MODE adds this at event delivery to listeners. This property is present if the event originates from a device.
originDeviceIpstringNoread-only (server-generated)IP address of device. This property is present if the event originates from a device. MODE adds this at event delivery to listeners.
originProjectKeyIdstringNoread-only (server-generated)If the event originates from a project API key, this property is the unique key ID. MODE adds this at event delivery to listener.
originProjectKeyNamestringNoread-only (server-generated)If the event originates from a project API key, this property is its display name. MODE adds this at event delivery to listener.
timestampstringNoread-only (server-generated); format: date-timeMoment when event was triggered. MODE adds this at event delivery to listeners. Devices don't need to add this.

Request example

{
  "eventData": {
    "appSerial": 14,
    "appTimestamp": 14243423423,
    "serial": 12,
    "timestamp": 1402313424,
    "zones": [
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      1
    ]
  },
  "eventType": "sprinkler-status"
}

Responses

204 Successfully sent device event to the cloud. 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 event 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 The service is temporarily unavailable.

Content type: application/json

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