HTTP call
Description
This unit is a Sink unit type.
A unit that sends http requests to a configurable endpoint. The response is stored in a configured field of the output event.
Events enter through the in port and are transformed according to the unit configuration. The events are enriched with the response field and unit configurations and sent to the out port.
If an error occurs, the input event is enriched with new fields describing the problem, and the event is sent through the error port.
Configuration
After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:
Tab | Field | Description | |
---|---|---|---|
General | Name | Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed. | |
Description | Enter a description for the unit. | ||
Schema | The protocol of the request. | ||
Host | Use the template to enter the target server address (can contain references to the input event fields). Template format: text %%{variable} text | ||
Path | Use the template to enter the path of the HTTP endpoint (can contain references to the input event fields). It should start with a slash. Template format: text %%{variable} text | ||
Accept self-signed certificate | If true, Self Signed Certificates are allowed and hostname verification is disabled. | ||
Method | Select the required HTTP method. | ||
Timeout | Connection request timeout (in seconds). | ||
Response field | Enter a name for the output event field containing the response body. | ||
Response headers field | Enter a name for the output event field containing a map with all response headers. | ||
Parameters | Click the plus icon to add field, name, value combinations for parameters. From field: Name and value taken from event. You can collapse and expand the parameters using the icon, reorder using the arrows, or delete using the X icon. | ||
Headers | Click the plus icon to add field, name and value combinations for headers. The possible combinations and outcomes are the same as for Parameters. You can collapse and expand the headers using the icon, reorder using the arrows, or delete using the X icon. | ||
HTTP Rules | HTTP Rules | Click the plus icon to add configuration rules for the http requests. You can collapse and expand the pairs using the icon, reorder using the arrows, or delete using the X icon. You can also drag and drop the fields to change the position. | |
Name | Enter a name for the rule. | ||
From HTTP Code | Enter the initial value of the desired HTTP range. In case only one HTTP status code is desired, just type the same value in initial (from) and final (to) HTTP status codes. | ||
To HTTP Code | Enter the final value of the desired HTTP range. In case only one HTTP status code is desired, just type the same value in initial (from) and final (to) HTTP status codes. | ||
Port Name | Enter the name of the new port to redirect events matching the HTTP condition. |
Input ports
Port | Description |
---|---|
in | All events enter through this port. |
Output ports
Port | Description |
---|---|
out | Outputs events enriched with the response field and unit configurations. |
error | Signals when an error occurred. Input events are enriched with standard error fields. |
Example
In this example, we want to send an HTTP request to the randomuser.me API, which retrieves random user information. To do it, we add a Tick unit to fire the request every time we need it. Then, we join its output port to an Http call unit, configured with the API information. Finally, we add an Email sink unit to send it to the required recipients.
In the HTTP call unit properties, you must specify the endpoint configurations as shown:
After saving and starting the Flow, you must click the red button of the Tick unit to begin sending events.
Download this example
You can try this flow by downloading this JSON file and uploading it to your domain using the Import option: