HTTP-request
Use this block to create an http-request to an external service. Depending on the selected method, you can either receive data from the service or send it to the service. You can select one of the following methods:
GET — Sends data from the resource. Requests to this method can only retrieve data.
POST — Sends data to the resource
HEAD — Sends a response from the resource
DELETE — Allows to delete the specified resource
PUT — Allows to replace the resource view with data from the request
PATCH — Applies partial modifications to a resource
To create an http-request, do the following:
- Connect the block by using the Success port.
- Double-click the HTTP-request block.
- In the General settings section:
Select a method you need from the Method drop-down list.
Enter the URL of the service in the URL:port field.
Enable the Play audio on dialing switch to activate audio playback. Select an audio file from the Audio library drop-down list. Click Upload to upload an audio file from your computer.
- In the Request headers section, specify the response headers necessary to request the service:
Click Add header.
Select the required header from the Header drop-down list.
Enter a variable in the Value field.
- In the Query parameters section, configure the query parameters:
Enter the necessary parameter in the Parameter field.
Enter a variable in the Value field.
- In the Response data mapping section, configure response parameters. Click Add response and select one of the following settings:
Using HTTP response data — Response based on an HTTP-request. Click Get data to configure response data based on scenario data.
Using JSON data example — Response based on JSON. Enter data in the JSON data field and click Parse data.
Specify data path manually — Enter or select a variable from the Variable drop-down list, enter a path in the Path field. If there is no data for the specified variable, set a value in the If path doesn’t exist field.
- Click Save or Save as template if needed.
Using HTTP response data
- In the Response data mapping section, click Add response and select Using HTTP response data from the drop-down list.
- In the Preview request window, click Get data.
If you entered variables in the HTTP-request block, the system requests to enter variable data to send a request.
- In the Server response window, select checkboxes next to the necessary fields.
The system writes data from these fields to the variables.
- Click Get variables.
Using JSON data
Use any API platform to get a required server response and write it to a JSON file.
- In the Response data mapping section, click Add response and select Using JSON data example from the drop-down list.
- Enter the previously generated server response and click Parse data.
- In the Server response window, select checkboxes next to the necessary fields.
The system writes data from these fields to the variables.
Specifying the data path
- In the Response data mapping section, click Add response and select Specify data path manually from the drop-down list.
- Select the name of a variable from the drop-down list. If the name of the variable is not found, enter the required name and press Enter.
- Enter the variable path and default variable value.
Split each object value with a forward slash.
- Click Save.
Different services and servers use their own methods, and it is better to create requests in accordance with them.