The REST API component can serve as a bridge between multiple flows by using Webhook and HTTP Reply components. This approach is particularly useful when you need to make a flow call more flexible, as the Webhook URL can be accessed from another flow or a third-party application. However, it’s important to note that this type of flow connection should not be used in other cases because it can create a heavier load than the Flow-Linking or PubSub components due to the creation of Webhooks and API requests.
To give you an example, you can imagine two Flows. Side Flow will perform the operation of splitting a string into an array of strings through a separator.
The main Flow will send the original string to the other Flow and receive the processed array of strings, then writing it to the database.
The side Flow will be triggered by the Webhook, retrieving the source string.
With a simple JSONata expression, the string will be converted to an array of strings and returned back via HTTP Reply
As a result, we obtain an isolated Webhook URL that can be accessed by any application, including other flows. When we send a POST request with a body string that needs to be separated through a comma separator, this Webhook is triggered.
The main flow will send a request with a source string to the other flow and use the result of the other flow.
As a result, we get communication between the two components through HTTP requests.
Click here to learn more about the elastic.io iPaaS