Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
What is a HTTP Action?
HTTP actions perform HTTP(S) requests to external APIs and return the response.
Creating HTTP Actions
- Click and drag the
icon from the toolbar onto the canvasInsert excerpt _http _http nopanel true - Enter a name for the HTTP action, then select Create Action
- In the HTTP action
on the right, populate the following details:Insert excerpt _property_settings _property_settings nopanel true
Field | Description | Example Value | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Name | Name given to the HTTP Node. This will be displayed on the Actionflow canvas. | BankHolidays | ||||||||||||||||
HTTP Method | The HTTP method. A drop-down field containing: GET, POST, GET or POST, HEAD, PUT, DELETE, other. If other is specified a text box will allow the entering of a custom value which is not empty and contains only uppercase letters. | Get | ||||||||||||||||
URL Template | A template that computes the URL of the request. Expects literal values or expressions encapsulated within ${} syntax, for example | https://www.gov.uk/bank-holidays.json | ||||||||||||||||
Body Template | Optional. If this is provided then it is used to carry the HTTP request data. If a body is provided then usually Content-Type and Content-Length headers lines specify the nature of the body associated. In PhixFlow if this evaluates to whitespace only then it is not included in the request. The body expects literal values, or expressions encapsulated within ${} syntax, for example | |||||||||||||||||
Error Expression | Optional. A JEP expression to determine if the response is an error and so sent on the error output. The expression will have access to the input record (in) and the mapped output response (_result). | |||||||||||||||||
Log Traffic | Toggle on
| |||||||||||||||||
Maximum HTTP Log Length | Available if Log Traffic is toggled on
Restricts the size of the log traffic. | |||||||||||||||||
Use Raw URL | Toggle on
If toggled off
|
4.
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
5. Hover over the
action on the canvas to see the output connection points Insert excerpt _http _http nopanel true
Output Connection Points
A HTTP action has two outputs. A HTTP request will be triggered for each input record and generate one output record, which will be sent on either the out or error output.
The response from the server (headers and body) will be treated as the result record..
Output Connection Point | Description |
---|---|
Out | Contains the resulting record of the request. |
Error | Contains the resulting record of the request where it satisfies the error expression specified on the HTTP Node. |
The output records contain the attributes specified by the output connection point, successful records are passed down the out connection point and records containing an error are passed down the error connection point. The structure of the records by default are as follows:
body: The content returned by a successful request, for example, JSON content
- contentType: The type of response provided by the target HTTP request, for example,
application/json; charset=utf-8
status: The returned status code, for example,
200
status message: The returned status message, for example,
OK
Adding and Editing
- To add a new output connection point, click the
icon, see Connection PointsInsert excerpt _addIcon _addIcon nopanel true
HTML Comment | ||
---|---|---|
| ||
ZB I couldn't create a new output connection point? |
Configuration
The configuration of each output connection point is identical:
Field | Description | Example |
---|---|---|
Name | Name of the output | out |
Output Type | A drop-down field containing: String, Raw Data, JSON. | String |
Skip Invalid Records | Skip attributes which are considered invalid. | Enabled |
Default Charset | A drop-down field containing character set options, including utf-8. | utf-8 |
Path | The JSON path to apply. If empty this will default to '$' which matches the entire object. | // $ returns everything, this syntax traverses down two levels using two full // stops.
|
JSON Lenient | When enabled this removes JSON specification restrictions, allowing for a degree of leniency in malformed JSON data. When disabled the JSON will be treated strictly. | Enabled |
Attributes | Contains the attributes which hold the values returned by the Output Connection Point. Result values are obtained using the keyword _result followed by the attribute name. | _result.status |
Headers
Headers are typically used to specify information for the request, such as character sets, session tokens or passwords. Headers can make use of the Secret Key Details.
For example,
- Name:
AuthValue
- Expression:
_datasource.MyKey
Secret Key Details
Secret Keys allow sensitive data, such as passwords or security tokens, to be encrypted and stored in the PhixFlow Database. See Secret Key and Local Secret.
HTML Comment | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
|
Worked Example
Excerpt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Here is a worked example using the Shop Data (available from the Learning Centre) and JSON data from the UK government website (https://www.gov.uk/bank-holidays.json). In this example, we are using:
Identify Bank Holiday DatesIn this example, we'll create an Actionflow that retrieves bank holiday dates in the UK from the government website in JSON format and map this onto a screen in a grid.
Table Setup
HTTP Action Setup
HTTP Action Setup
JSON Action Setup
Save Action and Open Screen Action Setup
Testing
Background Filter and Default Sort OrderTidy up your Shop Shipping Popup screen by hiding the UID column on the grid, adding a Default Filter to show only bank holidays in the future, and Default Sort Order to show the most recent bank holidays first.
|