Send request Version 16 (Java)

Action group: Integrations


Description

Sends an HTTP request to invoke a RESTful web service.

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
REST service URLREST service URL.

Robin.String


Yes
MethodRequest type. Default value is GET.

Robin.String


No
Request bodyRequest body, specified as a JSON string.

Robin.String


No
Request parametersQuery string parameters specified in the URL.

Robin.Dictionary


No
Form parametersHTML form parameters for the POST method.

Robin.Dictionary


No
Authentication typeThe type of authentication that will be used in the request being sent. If you do not fill in the "Authentication parameters" field, the selected "Authentication type" will be ignored. The default value is "No".

Robin.String


No
Authentication parameters

Authentication parameters for the request. If "Basic" or "NTLM" authentication type is selected, the dictionary must have "user" and "pass" keys containing the value of login and password, respectively. If the "Bearer Token" type is selected, the dictionary must have the "token" key with the value of the authentication token.

Robin.Dictionary


No
Request headersSet of request headings and their values. Each key in the dictionary is a separate header.

Robin.Dictionary


No
Selecting a proxy serverSpecifies the settings of the proxy server to be used. You can use the system proxy settings specified at the OS level, or configure custom proxy settings, or connect without a proxy server. By default, the system settings are used.

Robin.String


No
Proxy server protocolProxy server protocol. For example: http, https.

Robin.String


No
Proxy server addressHost name or IP address of the proxy server.

Robin.String


No
Proxy server portProxy server port.

Robin.String


No
Proxy server loginUser login to connect to the proxy server.

Robin.String


No
Proxy server passwordUser password to connect to the proxy server.

Robin.Object

trueNo
Get filePossibility to get files from the request. If "true" is selected, the "Folder path" and "File name" fields must be filled in.

Robin.Boolean

C:\doc\imgNo
Folder pathPath to the folder where you want to save the file received during the request.

Robin.FolderPath


No
File nameName, which will be used to name the file received when the request is executed. The name should be specified along with the extension that the file should have.

Robin.String

trueNo
OverwriteIf the value is "true" and a file with the same name and extension exists in the specified folder, the new file will overwrite it. If "false", the file will not be overwritten and the action will return an error.

Robin.Boolean

trueNo
Disable SSLIf the value is "true", the SSL certificate validation feature will be disabled.

Robin.Boolean



Results

Response statusThe status code of the response received from the web service. Returned when any method is used.

Robin.String



Response headersSet of headers and their values received from the web service. Returned when any method is used. If there are repeated headers in the response, there will be only one key with that header; the value of the key will be a collection containing all the values of those headers.

Robin.Dictionary



Response bodyThe body of the response received from the web service, in raw format. Returned when any method is used.

Robin.String



IDIdentifier value from the "Id" header received from the web service. Returned only when using the "POST" method.

Robin.String



LocationValue from the "Location" header received from the web service. Makes sense for statuses 201, 3xx and only for POST method.

Robin.String



Special conditions of use 

Read more about REST.

Example of use 1

Task

Send a GET request to https://dadata.ru/api/find-party/ , saving the result of the response to a json file.

Solution

Use the "Send request" action. 

Implementation

  1. Move the "Send request" action to the workspace and set its parameters. 
  2. The "Endpoint URL" field is the address to connect to. More detailed information about the method can be found at the following link: https://dadata.ru/api/find-party/

  3. The "Method" field - in our case it is necessary to specify the GET value. 

  4. "Get file" field - it is necessary to check the checkbox if necessary. It is used when it is necessary to receive a file from the service. The whole response from the service will be written to a separate file. 

  5. The "Path to file" and "File name" fields - must be filled in if the checkbox in the "Get file" field is checked. In the "File name" field it is necessary to specify the extension. 

  6. Click on the "Start" button in the top panel. 

Result 

The program robot completed successfully. A .json file with the response from the service was saved. 

Example of use 2

Task

Send a POST request to the  http://shop.bugred.ru/api/items/search/ service to retrieve actual product data and parse the response from the service, saving the result of the response to a .txt file.

Solution

Use the "Send request" action. 

Implementation 

Move the "Send request" action to the workspace and set its parameters. 

  1. The "Endpoint URL" field is the address to connect to (REST request) - http://shop.bugred.ru/api/items/search/. More detailed information about the method can be found at the following link.
  2. The "Method" field - in our case we need to specify the POST value.
  3. Field "Request body" - it is necessary to specify the text of the request body. {"query": "Skirt shorts"}
  4. Field "Request Headers" - a dictionary in which you need to specify the name of headers and their keys. In our case, a dictionary of 2 records. Example of filling in the "Request Headers" field:
  5. All other fields are irrelevant to the meaning of the request and its format. The fields starting from " Proxy server settings" and ending with the field "The password to the proxy server" are all fields that are related to proxy server configuration, if it is required. In our case, there is no proxy server.

  6. "Get file" field - it is necessary to check the checkbox if necessary. It is used when it is necessary to receive a file from the service. The whole response from the service will be written to a separate file. 

  7. The "Path to file" and "File name" fields - must be filled in if the checkbox in the "Get file" field is checked. In the "File name" field it is necessary to specify the extension. 

  8. The "Overwrite" field is necessary in case this folder already contains a file with the same name and extension.

  9. When launching the robot, you need to click on the "Start" button in the top panel. 

Result

The robot completed successfully. The response from the service is parsed by the robot.

Example of use 3

Task

It is necessary to send rest-request to the service https://dadata.ru/ to get actual data about the organization and parse the response from the service.

The solution shows how to correctly fill in the parameters for a particular task, as well as other parameters are considered.  

Solution

Use the "Send request" action. The entire workflow is shown in the robot's flowchart rest-zapros.robin-source . 

Transfer the "Send request" action to the workspace and customize its parameters. 

              

 

Result



Let's look at the action parameters in detail

  1. The "Endpoint URL" field is the address to connect to. We will connect to the dadata service. The body of the request looks like one line. The data is formed in JSON format. 
  2. The "Method" field - in our case we need to specify the POST value. 
  3. The "Request body" field - it is necessary to specify the text of the request body.   If the parameters should be passed not in the body, but in the URL, then in this case the parameters of the request should be specified in the URL. It depends on the service, i.e. how the service expects to receive the request (in the body of the request or in the URL). 
  4. The "Form Parameters" field - in this field you can fill in the values for the request body. Difference from the "Request body" field: "Request body" is a string, "Form parameters" is a dictionary.  The "Form parameters" field is used for POST method. The dictionary contains JSON object names, element names and further values for these elements. 
  5. The "Query parameters" field - is needed in case the service expects that the parameters of the request will be passed through the URL, and not through the body of the request.  
  6. The "Request Headers" field is a dictionary in which you need to specify the name of headers and their keys. In our case, the dictionary consists of 3 entries:
  7. Example of filling in the "Request Headers" field:
  8. One of the headers is the header with authorization.  It can be specified in the "Authorization" field, but it will not be an error if this header is specified in the "Request Headers" field. 
  9. Field "File path for sending by POST method"- it is necessary to specify the path to the file with the request, if it is required. 
  10. All other fields are irrelevant to the meaning of the request and its format. Fields from "Proxy server settings" to "The password of the  proxy server" are all fields that are related to proxy server configuration, if it is required
  11. In the "Proxy server settings" field you should choose which option to use
  12. If the system proxy server is selected, the server settings that are set in your system under which the robot is running will be used. 
  13. If "Without proxy" is selected, neither system settings nor any other settings are used. then neither system settings nor any other settings will be used. 
  14. If "System proxy" or " Without proxy" is selected, the fields below can be left blank. 
  15. Only if "Custom proxy" is selected, the fields below must be filled in (highlighted on the screen).  
  16. Other fields are related to receiving a file from the service. 
  17. The"Get file" field - it is necessary to check the checkbox if necessary. It is used when it is necessary to receive a file from the service. The whole response from the service will be written to a separate file. 
  18. The "Path to file" and "File name" fields - must be filled in if the checkbox is checked in the "Get file" field. In the "File name" field it is necessary to specify the extension. 
  19. The "Overwrite" field is necessary in case this folder already contains a file with the same name and extension
  20. When launching the robot, you need to click on the "Start" button in the top panel. 

Result

The robot completed successfully. The response from the service is parsed by the robot.  

  • Нет меток