Send event to an entity
PUT/projects/{projectId}/entities/{entityId}/event
Base URL: https://api.tinkermode.com
Send an event to the specified entity and propagate it to the relevant listeners.
Authentication
Send an Authorization header of the form ModeCloud <AUTH_CODE>.
Must contain a user API key of a user with permission to create entity event, a service account token with the same permission, or a project API key with permission to send events,
Path parameters
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
projectId | integer | Yes | The unique ID for a specified project. | |
entityId | string | Yes | Entity ID (unique within project) |
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 Event sent to entity successfully. 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. |