Create action

This API creates an action of the specified action type. Actions are associated with rules which listen for events. When an event occurs that causes a rule to evaluate to true, then the Ayla Rule Engine performs the action(s) associated with the rule. Action names must be unique for a particular user. See also Get action types.

Example request data

Actions include one or more parameters that supply the action with values (e.g. set the Blue_LED property to 1; post a json object to an endpoint). The action type dictates which parameters are required. Below are examples:

Datapoint
The required parameter is datapoint, which contains an ARES expression that assigns a value to a to-device property.

{
  "action": {
    "name": "Set DSN 001 Blue_LED true",
    "type": "DATAPOINT",
    "parameters": {
      "datapoint": "DATAPOINT(AC000W000000001, Blue_LED) = 1"
    }
  }
}

URL
The required parameters are body, a stringified JSON object, and endpoint, a url. The primary purpose of this action type is to post the body to the endpoint, replacing placeholders in body with values taken from the triggering event. It is the responsibility of the service to retrieve additional data as needed. The Alexa OAuth helper is an example of such a service.

{
  "action": {
    "name": "URL endpoint1",
    "type": "URL",
    "parameters": {
      "body": "{'key':'value'}",
      "endpoint": "https://webhooks/endpoint1"
    }
  }
}

Example response data

{
  "action": {
    "action_uuid": "a1234567-1234-1234-1234-a1234567890a",
    "name": "Set Blue_LED true",
    "user_uuid": "b1234567-1234-1234-1234-a1234567890a",
    "type": "DATAPOINT",
    "is_abstract": false,
    "parameters": {
      "datapoint": "DATAPOINT(AC000W000000001,Blue_LED) = 1"
    },
    "rule_ids": [],
    "created_at": "2020-08-05T18:13:21.932Z",
    "updated_at": "2020-08-05T18:13:21.932Z",
    "created_by": "b1234567-1234-1234-1234-a1234567890a",
    "updated_by": "b1234567-1234-1234-1234-a1234567890a",
    "oem": "1234abcd"
  }
}
Language
Authentication
Header
Click Try It! to start a request and see the response here!