Action
Manage Automated Actions.
Actions implement automated responses for specific device and cloud conditions. Actions are invoked by triggers to respond and implement a specific remedy or notification. .
Find
Find actions by matching properties and query parameters.
Endpoint
HTTP
POST /action/find
Authorized User Role
user
Request Body
Field | Type | Required | Notes |
---|---|---|---|
cloudId | string | yes | Filter by cloud ID. |
type | string | Filter by action type. Valid types are: alert, builder-alert, builder-metric, database, delay, device, email, eventbridge, http, lambda, metric, mqtt, and sms. |
Query String Options
Field | Type | Notes |
---|---|---|
filter | string | Full text string to filter for. |
next | object | Pagination token for the next page. |
prev | object | Pagination token for the previous page. |
limit | number | Number of items to retrieve. |
index | string | Database index to use. |
exists | boolean | Set to true to require the item exists, otherwise set to null to perform an upsert. |
Response
Paged response.
Field | Type | Notes |
---|---|---|
data | array | Array of items. |
next | string | Paged cursor to use for the next page of items. |
prev | string | Pages cursor to use for the previous page of items. |
Action
An array of Action items.
Field | Type | Notes |
---|---|---|
args | object | Action args. |
buffer | object | Buffer optimizations for metrics. |
cloudId | string | Owning device cloud ID. |
context | object | Trigger expression context, merged with user params. |
description | string | Action description. |
destination | string | URL, email address, function name, topic, phone number. |
due | number | When the action is next due. |
enable | boolean | Enable or disable the action. |
error | string | Error message from last invocation. |
expression | string | Trigger expression. |
format | string | Message format. |
id | string | Unique action ID. |
message | string | Message template/properties. |
name | string | Action name. |
poll | number | Delay between pollng the trigger. |
rearm | number | Time period to suppress triggering. |
severity | string | Alert severity. |
trigger | string | Source of action trigger. |
type | string | Action type. |
Get
Get an action by ID for a cloud.
Endpoint
HTTP
POST /action/get
Authorized User Role
admin
Request Body
Field | Type | Required | Notes |
---|---|---|---|
id | string | Action ID. | |
cloudId | string | yes | Filter by cloud ID. |
type | string | yes | Filter by action type. Valid types are: alert, builder-alert, builder-metric, database, delay, device, email, eventbridge, http, lambda, metric, mqtt, and sms. |
Response
Field | Type | Notes |
---|---|---|
args | object | Action args. |
buffer | object | Buffer optimizations for metrics. |
cloudId | string | Owning device cloud ID. |
context | object | Trigger expression context, merged with user params. |
description | string | Action description. |
destination | string | URL, email address, function name, topic, phone number. |
due | number | When the action is next due. |
enable | boolean | Enable or disable the action. |
error | string | Error message from last invocation. |
expression | string | Trigger expression. |
format | string | Message format. |
id | string | Unique action ID. |
message | string | Message template/properties. |
name | string | Action name. |
poll | number | Delay between pollng the trigger. |
rearm | number | Time period to suppress triggering. |
severity | string | Alert severity. |
trigger | string | Source of action trigger. |
type | string | Action type. |
Invoke
Invoke an action by ID or name.
Endpoint
HTTP
POST /action/invoke
Authorized User Role
user
Request Body
Field | Type | Notes |
---|---|---|
id | string | Action ID. |
name | string | Action name if ID not provided. |
params | object | Parameters for the action. |
context | object | Context for the action. |
Response
Field | Type | Notes |
---|---|---|
* | string | Description saying the action was invoked. |
Example
Example action invocation using curl to invoke an action by name.
curl
curl -X POST \
https://xrp7t2deqh.execute-api.ap-southeast-1.amazonaws.com/tok/action/invoke \
-H 'Authorization: 1234567990XXXXXXXXXXXXXXXX' \
-H 'Content-Type: application/json' \
-d '{"name":"myAction", "params":{"deviceId": "ZXXXXXXXXX"}, "context":{}}'