activities
latest
false
Developer Activities
Last updated Oct 22, 2024

HTTP Request

UiPath.WebAPI.Activities.HttpClient

Description

Enables you to perform HTTP requests to a specified web API. When first dragging this activity to the Designer panel, the HTTP Request Wizard window is displayed, providing an easier way of building requests and previewing server responses.

Note: If the returned HTTP status code (StatusCode) is 0, it means that the server did not return an actual response for some reason. This usually points to some connectivity or network issues you might be having.
Important: The WebAPI package is not compatible with the following activities: UiPath.Salesforce.Activities and UiPath.Jira.Activities.

Project compatibility

Windows - Legacy | Windows | Cross-platform

Windows, Windows - Legacy configuration

The Import Wizard Window

You can use this to import a HTTP Request in a CURL format.

The HTTP Request Wizard Window

All fields present in the wizard are also available in the Properties panel. As a result, you can still edit your preferences after closing the wizard. You can configure the activty in the wizard using hardcoded values or variables.

Note: When variables are used, the preview functionality is not available.
docs image

The Request Builder Tab

  • End Point - The URL to which you want to make the request. Custom segments have to be placed between braces "{}" and defined in the Parameters section. For example, this URL https://platform.uipath.com/odata/Robots(28) can be written as https://platform.uipath.com/odata/Robots({id}), and the value of the id parameter can be provided in the Parameters section, as a UrlSegment.
  • Preview URL - A preview of the URL provided in the End Point field, taking into account the information provided in the Parameters section.
  • Enable SSL certificate verification - Check this box to verify SSL certificates when sending a request. Verification failures will result in the request being aborted.
  • Timeout - Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown. The default value is 6000 milliseconds (6 seconds).
  • Client Certificate - The location in which the Client Certificate file is stored. The full path must be provided. The supported certificate encoding is X.509 and the supported extensions are .pfx and .p12.
    Note: The path must not be written between quotation marks.
  • Client Certificate Password - The password that corresponds to the Client Certificate file you are using.
  • Request Method - The request method to be used when calling the API. The following HTTP verbs are supported: GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH and MERGE. By default, the GET method is selected.
  • Authentication - Specifies the authentication protocol to be used when calling the API. The following protocols are supported:

    • None - The default option. It should be used if the web server you are sending requests to does not require an authentication protocol.
    • Simple Http - This option has to be selected if the API you are making requests to uses a simple HTTP authentication protocol. If chosen, two additional fields are displayed - Username and Password, which have to be filled in with valid credentials for the specified API.
    • OAuth1 - This option has to be selected if the API you are making requests to uses an OAuth1 protocol. If chosen, four fields are displayed: Consumer Key, Consumer Secret, Access Token, Access Token Secret.
    • OAuth2 - This option has to be selected if the API you are making requests to uses an OAuth2 protocol. If chosen, the Access Token field is displayed. This access token is usually generated as a response to another HTTP request to the indicated API.

The Parameters Section

  • Add Parameter - Adds a new line in the Parameters table, with the GetOrPost type. A new line is not added if the previous line is not filled in.
  • Add Header - Adds a new line in the Parameter table, with the HttpHeader type. A new line is not added if the previous line is not filled in.

    Note: In the case where you want to add multiple values for a header, they must be concatenated through a comma (,).
  • Add URL Segment - Adds a new line in the Parameters table, with the UrlSegment type. A new line is not added if the previous line is not filled in.
  • Delete - Removes a selected line in the Parameters table. If a line is not selected, this button is disabled.

The Parameters Table

  • Name - The name of the parameter, header or URL segment.
  • Value - The value of the parameter, header or URL segment.
  • Type - The type of line. The following options are available:

    • GetOrPost - Indicates that the line is a parameter that can be used in requests.
    • HttpHeader - Indicates that the line added in the Parameters table is a request header to be sent when making the API call.
    • UrlSegment - Indicates that the line added is a fragment or the URL provided in the End point field.

      Note: In some cases, an error might be returned stating that duplicate parameters cannot exist. These may be caused by authentication requests that need to contain the Password and Username parameters. In these cases, we recommend passing them using the Body property.

The Attachments Section

  • Add Attachment - Enables you to add a file to the HTTP request performed, by creating a new line. Enabled only when the Request Method is set to POST or PUT.
  • Delete Attachment - Enables you to delete a previously added line, in the Attachments section.
  • Name - The name of the file you want to attach.
  • File Path - The full path of the file you want to attach.
  • Type - Indicates what type of information you are sending. This field is automatically filled in with Attachment.Preview - Enables you to preview the HTTP request you built, and opens the Response tab.

The Response Tab

This tab enables you to preview the request that you want to include in your workflow. It can be accessed by selecting the Preview button in the HTTP Request wizard once you fill in all the fields and configure the request. Alternatively, you can also change the tab in the upper part of the wizard.



This page comprises the following:

  • Request Info - This section displays details about the request that was performed. It displays the request URL, method and status code.
  • Preview Response - Displays the web server's response.
  • Raw Body - Displays the web server's response, in a raw form.
  • Response Info - Displays details about the web server's response. It displays the response status and code, and the content-type header supported.
  • Download Resource - Enables you to download the requested resources to an indicated file.
  • Refresh - Enables you to perform the request again.
Properties panel

Client CertificateAuthentication

  • ClientCertificate - The location in which the Client Certificate file is stored. The full path must be provided. The supported certificate encoding is X.509 and the supported extensions are .pfx and .p12.
  • ClientCertificatePassword - The password that corresponds to the Client Certificate file you are using.
  • Enable SSL certificate verification - Verify SSL certificates when sending a request. Verification failures will result in the request being aborted. This field only supports Boolean values (True, False).
  • SecureClientCertificatePassword - The password for the specified Client Certificate file, in the form of a secure string. This field supports only SecureString variables.

Common

  • ContinueOnError - Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False). The default value is False. As a result, if the field is blank and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.

    Note: If this activity is included in Try Catch and the value of the ContinueOnError property is True, no error is caught when the project is executed.
  • DisplayName - The display name of the activity.
  • Timeout (milliseconds) - Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown. The default value is 6000 milliseconds (6 seconds).

Input

  • AcceptFormat - The format in which to receive the web server's response. The following options are supported: ANY - the default value, XML, JSON, and CUSTOM. When choosing the CUSTOM AcceptFormat, if an Accept or accept Header parameter is present, then it will be sent as the custom accept format. If no header parameter is set, accept will get the RestSharp default value: application/json, aboveapplication/xml, text/json, text/x-json, text/javascript, text/xml.
  • Request Method - The request method to be used when calling the API. The following HTTP verbs are supported: GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH and MERGE. By default, the GET method is selected.
    Note: HTTP Request works properly only with RestSharp package version 106.11.2 or lower. It returns an error when RestSharp version 106.11.4 or higher is installed.
  • Request URL - The URL to which you want to make the request. Custom segments have to be placed between braces "{}" and defined in the Parameters section. For example, this URL https://platform.uipath.com/odata/Robots(28) can be written as https://platform.uipath.com/odata/Robots{id}, and the value of the id parameter can be provided in the URLSegments window.

Misc

  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.

OAuth1

  • ConsumerKey - The consumer key to be used if the API you are making requests to is based on the OAuth1 authentication protocol.
  • ConsumerSecret - The consumer secret to be used if the API you are making requests to is based on the OAuth1 authentication protocol.
  • OAuth1Token - The access token to be used if the API you are making requests to is based on the OAuth1 authentication protocol, after an authorization request for the consumer has been approved.
  • OAuth1TokenSecret - The secret to be used if the API you are making requests to is based on the OAuth1 authentication protocol, after an authorization request for the consumer has been approved.

OAuth2

  • OAuth2Token - The access token to be used if the API you are making requests to is based on the OAuth2 authentication protocol. This access token is usually generated as a response to another HTTP request to the indicated API.

Options

  • Attachments - Enables you to attach files to requests. Select the Ellipsis button to open the Attachments window and add all the required files.
  • Body - The body of the request.
  • BodyFormat - The format in which the body has to be. By default, it is filled in with application/xml. This field supports strings and string variables.
  • Cookies - The cookies in the HTTP Request. Select the Ellipsis button to open the Cookies window.
  • File attachments - List of attachments for the request.
  • Filename for response attachment - The filename to be used for the file returned by the request.
  • Headers - Enables you to include custom headers in the HTTP request. Select the Ellipsis button to open the Headers window.
  • Parameters - The request parameters. Select the Ellipsis button to open the Parameters window, which corresponds to the Parameters section.
  • UrlSegments - Custom segments added to the Endpoint URL between braces "{}". Select the Ellipsis button to open the URLSegments window. For example, the https://platform.uipath.com/odata/Robots(28) URL can be written as https://platform.uipath.com/odata/Robots{id}, and the value of the id parameter can be provided in the URLSegments window. This field supports strings and string variables.

Output

  • Headers - The response received from the HTTP request.
  • Response attachment - The attachment saved from the response.
  • Response content - The response received from the HTTP request, as a string variable.
  • Response status - The status code received from the HTTP request, as an integer variable.

Simple Authentication

  • Password - Indicates that the web service uses simple authentication and enables you to input your password. Adding a username is also required. This property supports strings and string variables.
  • SecurePassword - Indicates that the web service uses secure authentication and enables you to input your secure string password. Adding a username is also required. This property supports secure string variables.
  • Username - Indicates that the web service uses simple authentication and enables you to input your username. Adding a password is also required. This property supports strings and string variables.

Cross-platform configuration

  • Request Method - The request method to be used when calling the API. The following HTTP verbs are supported: GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH and MERGE. By default, the GET method is selected.
  • Request URL - The URL to which you want to make the request. Custom segments have to be placed between braces "{}" and defined in the Parameters section. For example, this URL https://platform.uipath.com/odata/Robots(28) can be written as https://platform.uipath.com/odata/Robots{id}, and the value of the id parameter can be provided in the URLSegments window.
  • Parameters - The request parameters. Select the field to open the Dictionary window.
  • Headers - Enables you to include custom headers in the HTTP request. Select the field to open the Dictionary window.
  • Body - The body of the request.
  • Authentication - Specifies the authentication protocol to be used when calling the API. The following protocols are supported:
    • None - The default option. It should be used if the web server you are sending requests to does not require an authentication protocol.
    • Simple Http - This option has to be selected if the API you are making requests to uses a simple HTTP authentication protocol. If chosen, two additional fields are displayed - Username and Password, which have to be filled in with valid credentials for the specified API.
    • OAuth1 - This option has to be selected if the API you are making requests to uses an OAuth1 protocol. If chosen, four additional fields are displayed: Consumer Key, Consumer Secret, Access Token, Access Token Secret.
    • OAuth2 - This option has to be selected if the API you are making requests to uses an OAuth2 protocol. If chosen, the Access Token field is displayed. This access token is usually generated as a response to another HTTP request to the indicated API.
    • Client Certificate - This option has to be selected if a client certificate is needed to complete the API call. If chosen, two additional fields are displayed:
      • ClientCertificate - The location in which the Client Certificate file is stored. The full path must be provided. The supported certificate encoding is X.509 and the supported extensions are .pfx and .p12.
      • ClientCertificatePassword - The password that corresponds to the Client Certificate file you are using.

Advanced

Options

  • Timeout (milliseconds) - Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown. The default value is 6000 milliseconds (6 seconds).
  • Continue On Error - Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False). The default value is False. As a result, if the field is not configured and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.
  • SSL certificate verification - If selected, verifies SSL certificates when sending a request. Verification failures will result in the request being aborted.
  • Accept Format - The format in which to receive the web server's response. The following options are supported: ANY - the default value, XML, JSON, and CUSTOM. When choosing the CUSTOM AcceptFormat, if an Accept or accept Header parameter is present, then it will be sent as the custom accept format. If no header parameter is set, accept will get the RestSharp default value:
    application/json, application/xml, text/json, text/x-json, text/javascript,
                            text/xmlapplication/json, application/xml, text/json, text/x-json, text/javascript,
                            text/xml
  • File Attachments - List of attachments for the request.
  • Filename for response attachment - The filename to be used for the file returned by the request.
  • BodyFormat - The format in which the body has to be. By default, it is filled in with application/xml. This field supports strings and string variables.
  • Cookies - The cookies in the HTTP Request. Select the field to open the Dictionary window.
  • URL Segments - Custom segments added to the Endpoint URL between braces "{}". Select the field to open the Dictionary window. For example, the https://platform.uipath.com/odata/Robots(28) URL can be written as https://platform.uipath.com/odata/Robots{id}, and the value of the id parameter can be provided in the Dictionary window. This field supports strings and string variables.

Output

  • Response content - The response received from the HTTP request, as a string variable.
  • Response status - The status code received from the HTTP request, as an integer variable.
  • Response headers - The response received from the HTTP request.
  • Response attachment - The attachment saved from the response.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.