InvokeRESTService

This Activity is used to request a REST service. It also accepts the reply returned by the service.

Settings

Field Description
API Spec (Optional) Click Browse and browse to the file location on the machine. Select a JSON file.

Supported specifications are Swagger Specification 2.0 and OpenAPI Specification 3.0.

Click the Use app level spec toggle to select an API uploaded on the SPECS tab. Once you select the API Spec, the other fields, such as Path and Method, are populated per the spec.

Resource Path
Note: This field is only displayed if you upload a JSON file in the API Spec field.

All resource paths available in the JSON file (that is, the Swagger 2.0 or OpenAPI 3.0 specification file you uploaded) are listed in the dropdown menu. Depending on the resource path you select, the supported operations are listed in the Method field.

Enable Authentication

Select True if you want to enable authentication and authorization for your apps using the HTTP Client Authorization Configuration connection.

Default: False

Authentication Connection
Note: This field is displayed only if the Enable Authentication field is set to True.

Select a connection that you have set up from the dropdown list.

For information on setting up a connection, refer to HTTP Client Authorization Configuration.

Method Select an operation for the request. For example: GET, POST, PUT, DELETE, or PATCH.
URL

An absolute path to the REST service that you want to invoke. For example: http://acme.com or https://acme.com.

Note: If you upload an OpenAPI 3.0 JSON specification file in the API Spec field, the URL is a dropdown list. This lists the server URLs mentioned in the JSON file. Select a server URL from the list.
Tip: To dynamically override the path provided in the URL, you can enter the URL as:
http://<host-url>:port/{path}
Here, {path} is the parameter that can be modified. You can map this parameter in the Input section and assign values to it from the previous activities or the app properties.
Use certificate for verification

This field is displayed if you enter an absolute path beginning with https:// in the URL field. Set this to True to use a certificate for a secure connection to the server.

Default: False

Use mTLS

Set to True to enable mutual authentication for a secure connection to the server.

Default: False

Client Certificate

This field is displayed only if Use mTLS is set to True.

This certificate is used to identify the client by the servers over TLS. The certificate must be PEM encoded. Click Browse and select the client certificate.

Alternatively, you can configure the app property by using the Bind an Application Property toggle. Set the Base64-encoded value of the client certificate to the corresponding app property or pass file path as file://path/to/cert/file.

Client Key

This field is displayed only if Use mTLS is set to True.

Click Browse and select the client key. The key file must be PEM encoded.

Alternatively, you can configure the app property by using the Bind an Application Property toggle. Set the Base64-encoded value of the client key to the corresponding app property or pass the file path as file://path/to/key/file.

CA/Server Certificate

Click Browse and select a certificate authority (CA) certificate that verifies the client's certificate or the server certificate to establish a secure connection during the TLS handshake. The certificate must be PEM encoded.

Alternatively, you can configure the app property by using the Bind an Application Property toggle. Set the Base64-encoded value of the CA/Server certificate to the corresponding app property or pass file path as file://path/to/cert/file.

You can copy the server/root certificate under the system CA certificates. The activity loads all system certificates and appends any user-configured certificates. Providing a certificate in the CA/Server certificate field is not mandatory.

Disable SSL Verification

Set to True to disable SSL verification when invoking SSL and mTLS-enabled services.

Note: It is not a best practice to enable this field for a production environment.

Default: False

Close Connection Select True if you want to terminate the connection to the server after the response is processed. This affects the performance as the connection is no longer cached.
Default: False
Follow Redirects

If set to false, the HTTP client does not follow any redirects automatically. It returns the initial response.

Default: True

Timeout

Specify the timeout period (in milliseconds) for invoking a service. If a timeout value is specified, the Activity waits for the specified time. If the response is not received by the specified time, the request expires with an error.

Default: 0 milliseconds (that is, there is no timeout for invoking a service)

Request Type
Note: This field is displayed only for the POST, PUT, and PATCH methods.
The Request content type of the REST service. The following content-type are supported:
  • text/plain
  • application/json
  • application/x-www-form-urlencoded
  • multipart/form-data
Note:
  • If you select application/x-www-form-urlencoded, the default schema is set in the Request Schema field of the Input Settings tab. You can edit the default schema or specify your schema. If you specify your schema, it must be a name-value string pair.

  • For the application/x-www-form-urlencoded request type, use the url.queryEscape function to get the expected input at the server.


  • If you select the multipart or form-data as a request type, then you can pass the content-type for the file and files options in the Input.

  • If you do not set the content-type, then the application/octet-stream is set as the default content-type for file and files input.

Proxy

Specify the URL to the HTTP proxy server. If a proxy URL is specified, the request to the REST service (specified in the URL field) is routed via this proxy URL.

Note: A secure connection to the proxy server is not supported.

Default: Proxy URL is disabled.

Input Settings

Field Description
Query Params Query parameters to be appended to the path. To add the query parameters, click and press Enter to save your changes.
  • parameterName: Name of the query parameter.

  • type: The data type of the query parameter. Supported types are string, number, boolean, and object.

    Note: Only a simple JSON object type is supported.
  • required: Set to True if the query parameter is a required configuration. The trigger reports an error if no values are provided to the required query parameter.

Path Params Path parameters that are appended to the path. This is a non-editable field.
  • parameterName: Name of the path parameter. This is the parameter specified in between { } in the Resource Path field or the URL field in Settings.

  • type: The data type of the path parameter. The Supported type is string.

Request Headers Header values for the InvokeRESTService Activity. To add the header parameters, click and press Enter to save your changes.
  • parameterName: Name of the header parameter.

  • type: The data type of the header parameter. Supported types are string, number, and boolean.

  • required: Set to True if the header parameter is a required configuration. The trigger reports an error if no values are provided to the required header parameter.

Request Schema

Enter a request schema here. This field is visible only if you selected the POST, PUT, PATCH, or DELETE method on the Settings tab.

Note:
  • For the DELETE method, specifying the request schema here is supported for manual configuration only and not when configured with API specification.

  • If you selected application/x-www-form-urlencoded as the Request Type on the Settings tab, the default schema is set here. You can edit the default schema or specify your schema. If you specify your schema, it must be a name-value string pair.

Multipart Data This field is displayed in place of the Request Schema field if you select multipart/form-data as the Request Type on the Settings tab. Click to add the parameters.
  • Name: Name of the parameter.

  • Type: The supported types are string, object, and filecontent, file, and files.

    • For file types, such as images and PDF files, convert your file to Base64 format and enter the encoded value as the Input.

    • To send the file name and the file content in the same request, use file or files types. With file type, you can send one file and a file name. With the type files, you can send multiple file contents for one file name.

  • Required: Check the box if the parameter is a required configuration.

  • Schema: Enter the JSON schema in this field if the Type is an object.

    Note: If you want to pass dynamic data to a multipartFormData field, no data must be defined in the MultipartData table. Otherwise, the dynamic data is not honored and only table field values are considered.

Input

Note: If you upload a JSON file in the API Spec field, the Input fields are automatically populated according to the Resource Path and Method you select.
Field Description
host Specify the value that must override the hostname:port value specified in the URL at runtime with the value specified in this configuration. Enter a value in the form hostname[:port] where [:port] is optional.
serviceUrl

Specify the complete endpoint URL of the service, including protocol http/https, hostname, basepath, and path and query parameter value that must override the value specified in Settings > URL and Input > host at runtime with the value specified in this configuration. Query parameters added in the Input Settings are ignored when serviceUrl is configured. If you want to append query parameters in endpoint URL, you must add them to the serviceUrl. Enter a value in the following format: https://www.example.com:9999/basepath/pathparam?queryparam=example

The serviceUrl field takes the highest priority in determining the endpoint URL. The URL value is prioritized in the following order:

  • serviceUrl

  • host

  • URL value configured in the Settings tab

queryParams Provide a value to the query parameters configured in the Input Settings section.
pathParams Provide a value to the path parameters defined as part of the URL on the Settings tab.
headers Header values for the Activity. These values can be manually entered or mapped to the output of the trigger or any preceding Activity.
dynamicRequestHeaders

An array of additional header parameters to add request headers at runtime when invoking a REST Service. The header includes the following information:

name: the name of the header

value: the value of the header

These values can be entered manually or mapped to the output of the trigger or any preceding Activity.

Note: If a header is defined in both the header and dynamicRequestHeader (mapped or dynamically provided) fields, then the value from dynamicRequestHeader takes precedence.

body

Request Schema values for the Activity. These values can be manually entered or mapped to the output of the trigger or any preceding Activity. This field is visible only if you selected the POST, PUT, PATCH, or DELETE method on the Settings tab.

Note: For the DELETE method, specifying the request schema here is supported for manual configuration only and not when configured with API specification.
multipartFormData This field is visible if you select file or files type in the Multipart Data field on the Input Settings tab.

Each file that you enter in the Multipart Data table appears here. content, filename and content-type fields are displayed for each file.

Output Settings

Note: If you upload a JSON file in the API Spec field, the fields in Output Settings are automatically populated according to the Resource Path you select.
Field Description
Configure Response Codes This allows you to configure response codes.

Default: False (See "Response Schema" and "Response Type" in this table.)

To specify a response code, select True and click . Enter the following details:

  • Code: Enter a specific response code or configure a single schema for a category of response codes. For example, if all the status codes are similar (such as 501, 502, 503), you can define a single schema (as 5xx) for them. Defining a single schema saves you time and effort as you do not need to configure each status code separately in the Activity.
    Note: If the status code is provided as a range (5xx in the above example) and also in an absolute format (501 in the above example), the status code in the absolute format is given priority. In the above example, status code 501 is given priority over 5xx at runtime.
  • Type: Select the type of response expected for the Code. Supported types are String and Object.

  • Response Body: If the Object is selected as the Type, enter the JSON schema in the Response Body column. For String, you need not enter anything in the Response Body column.

  • Response Headers: Specify the response header corresponding to the response code.
  • Actions: The actions displayed change based on the type of the response code.
    • Edit, Delete: For the Object type of response, you can edit the details or cancel it.
    • Save, Cancel: For a String type of response, you can save or cancel the changes.

The response codes appear on the Output tab.

Throw Error

If set to True, the flow execution goes to the Error Handler for an error response of 400 or higher. The flow continues running for a Success response code of less than 400.

Default: False

Response Schema
Note: This field is displayed only when Configure Response Codes is set to False.
The schema for the reply that the server sends.
Response Type
Note: This field is displayed only when Configure Response Codes is set to False.

The content type of the REST service. The following content types are supported:

  • application/json
  • application/xml
  • text/plain
  • other

Default: application/json

JSON to XML conversion is not supported by the REST Activity. Any service that requires data in XML format cannot be invoked after providing data in the JSON format using REST Activity.

If the content type is other than the types application/json, application/xml, or text/plain, it is converted into Base64 encoded values. You can use the utils.decodeBase64 function to get the actual values. This is applicable when Configure Response Codes is set to True or False.

Output Format
Note: This field appears only when the Response Type is set as application/xml.

The format of the requested content for the application/xml response type. The following formats are supported:

  • JSON Object

  • XML String

Response Schema

Sample JSON schema for the response that the REST service returns.

The JSON schema in this field is editable for the following settings only:

  • When the Response Type is set as application/json

  • When the Response Type is set as application/xml and the Output Format is set as JSON Object

Response Headers

The header parameters for the reply.

Tip: If you want to fetch a cookie coming with a response, add a new row with Set-Cookie as the parameter. You can also map this parameter to subsequent activities in the flow.

Output

The Output tab displays the headers and responsebody configured for the response in a tree format. The responseTimeInMilliSec parameter specifies the time taken to receive the response in milliseconds.

Loop

For more information on the Loop tab, see Using the Loop Feature in an Activity.

Retry on Error

See Using the Retry on Error Feature in an Activity

Circuit Breaker

For more information on the Circuit Breaker tab, see Using the Circuit Breaker in an Activity.

Note: Enable either Retry on Error or Circuit breaker to handle service failures but not both. If both are enabled for the activity then Retry on Error is preferred.
Note: To update all these settings for the InvokeRestService activity configured from Swagger 2.0 or OpenAPI 3.0 specification, change the API specification file and upload it to Settings. Do not update the settings, except adding custom Headers, as manual updates are removed and the settings sync back to API specification configuration values.