Sending notifications through an HTTP-request
If it is necessary to transmit or, by the opposite, to load data from an external service in the business logic implementation, sending HTTP-requests may be used.
For that, the command “Make HTTP-request” should be added on entering the state of an automation script or on exit from it. By clicking on this command, the sidebar will appear to configure the request. There may be set:
- Method of the request. Five main requests are added in the system:
- GET, acquiring data from the specified resource;
- POST, sending data to a resource;
- PUT, storing data on a resource entirely;
- PATCH, applying partial modifications to a resource;
- DELETE, deleting data from a resource.
- URL – address on which the request will be sent. This is the full address of a resource.
- Headers allowing to take into account the features of data representation and transmission to a server. Here may be specified the authorization parameters, the message body language, the message formats required on the side of a client or a server, options for the current connection, etc.
- Body of the message in which the message data are set taking into account the required encoding (see paragraph Notifications). The body isn’t necessary.
Based on filling these fields after saving all changes, the HTTP-request will be configured taking into account rules of its structure forming. As a result, after the final state machine starting, the HTTP-request will be sent to the external service and actions, specified in the request, will be fulfilled when the object will be in the corresponding state.
In this way, using the HTTP requests may allow realizing the interaction with external services such as mobile and web-applications, CRM and ERP systems, etc. Eventually, it can lead to expanding the functionality and possibilities of developed IoT-project.