Http Client
Perform an HTTP request to a specified endpoint
When to use?
When you want to access data from a web service endpoint
How to use:
- Select a Scope type from the drop-down
- Scope type installation is for the duration of the whole installation and has the longest life span
- Scope type session is for the duration of the session
- Scope type request is for the duration of a single request
- Select if the result Parameters will be stored as either service or block variables
- In the Result name field enter the name the result will be stored under
- In the Endpoint URL field enter the URL you wish to send request to
- In the Content type drop-down enter the content type you're expecting to get in the headers
- In the HTTP method drop-down choose between GET or POST methods
- You can cache GET requests by entering a Cache timeout number in seconds
- In the Timeout field enter how long should a request wait for a response in seconds
- In the Headers field you can add HTTP headers, and in the Parameters field you can add parameters to be sent with the request
- You can also send JSON format Request Body in the POST request
- The element contains two flows to be executed, depending on the request success: OK and NOK
- You can access the result body in the OK flow like this: ${resultName.body.valueYouWantToAccess}
- To access the response status code and error messages use this syntax: ${resultName.status}
Example of usage
Accessing horoscope API endpoint and outputting horoscope data:
- Scope type: Installation
- Parameters: Block Params
- Result name: row
- Endpoint URL: http://ohmanda.com/api/horoscope/${horoscopeSign}/
- Content type: JSON
- HTTP method: GET
- Timeout: 1
- For output, place the Text Response element in the OK flow and enter this in the TEXT field,: ${row.body.horoscope}