Skip to main content

Installing a Trigger

To install a Trigger, you need its JSON definition. If you have access to the Data Orchestrator Dashboard, you can use its Trigger Editor to build your JSON definition and install the Trigger directly. If you already have a JSON definition instead, you can either use astartectl or Realm Management APIs.

The name of the Trigger must be unique within the Realm, or an error will be returned.

Installing a Trigger using Data Orchestrator Dashboard​

After logging in, navigate to the Triggers page using the menu on the left. Click on "Install a new Trigger..." in the top-right corner. The Trigger Editor will open, and you can either paste/write a JSON definition, or use the declarative editor.

When you are done, click on the "Install Trigger" button at the bottom of the declarative editor to install the Trigger in the Realm.

Installing a Trigger using astartectl​

Assuming the Trigger definition is contained in my_connection_trigger.json,

$ astartectl realm-management triggers install my_connection_trigger.json
ok

Installing a Trigger using Realm Management APIs​

POST api.<astarte base URL>/realmmanagement/v1/<realm name>/triggers

The POST request must have the following request body, with content type application/json

{
"data": {
"name": "my_connection_trigger",
"action": {
"http_url": "<url>",
"http_method": "<method>"
},
"simple_triggers": [
{
"type": "device_trigger",
"device_id": "*",
"on": "device_connected"
}
]
}
}