Calling REST Service as an Action in IoT-Ignite Rule
Creating A Rule with REST action
In this document, we will create a simple rule using IoT-Ignite Rule Editor and explain how to call external REST service as an action. IoT-Ignite Platform lets you write rules to call your own rest services as actions. It is definitely not limited to your own services, it could be any REST service.
You can reach generic information about what a rule means in IoT-Ignite platform in IoT-Ignite Rule Management document.
Firstly, we must login IoT-Ignite Enterprise interface with our DevZone account credentials. Afterward, we must open Cloud Rules page.
In the cloud rules page, we must click “New Cloud Rule” button to access Rule Editor. Rule Editor is a drag & drop tool to create a rule. There are three components in this rule: input, operation, and action. If sensor data matches input value in an operation, an action occurs. In this article, we will use REST Service action.
First of all, we must use Sensor Data as an input. We can select specific sensor in the Sensor Data element.
Secondly, we must choose operation and set value to match input value.
Finally, REST Service action component must be used to call external REST Services. REST URL, authentication token and data to post can be set in this component.
You should save this rule after all elements are connected. After that, it can run on IoT-Ignite Cloud.
In the REST Service action, we set 3 parameters:
URL: External service URL that will execute the action of the rule.
Token: It is used for authentication to access REST services. It is located in the request header.
Data: It is the HTTP POST data parameter that REST service will consume.