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
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
deviceId | integer | Yes | Device ID |
Request body
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
eventData | object | Yes | Event-specific data as a JSON hash. Opaque to the cloud service. | |
eventType | string | Yes | pattern: ^[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. |
homeId | integer | No | read-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. |
originDeviceClass | string | No | read-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. |
originDeviceId | integer | No | read-only (server-generated) | MODE adds this at event delivery to listeners. This property is present if the event originates from a device. |
originDeviceIp | string | No | read-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. |
originProjectKeyId | string | No | read-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. |
originProjectKeyName | string | No | read-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. |
timestamp | string | No | read-only (server-generated); format: date-time | Moment 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
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
403 Request failed because of invalid data or denied permission.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
404 The requested event does not exist or is not accessible.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
429 Request failed because of rate limit.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
500 An unexpected error has occurred.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
503 The service is temporarily unavailable.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |