Rest Api Action

Rest Api Action icon

Handles RESTful API calls asynchronously to better handle high loads. This action enables the system to handle higher loads, as it does not require a blocking thread (currently REST API action calls are executed using a Snippet action, which requires a blocking thread).

Properties

Property Details
Verb Supports basic REST actions such as GET, PUT, POST, DELETE, and PATCH.
Parameters Supports ability to specify query parameters or post any data. Any kind of JSON - Jobject , Jarray, Jtoken should be acceptable. Currently, the action requires JSON to be provided in a single line. Variable substitution from string containing Json or converting Dynamic Data type to json using the .asjson() method is supported. You can also pass the output variable resultSet(out) from previous REST API action to this property as well.
Headers

Supports the ability to add custom headers to allow for customer authentication (such as bearer tokens). Key value pairs expressed in JSON format is accepted. This action requires JSON to be provided in a single line. Variable substitution from a string containing JSON or converting Dynamic Data type to JSON using the .asjson() method is supported. You can also pass the output variable resultSet(out) from a previous REST API action to this property as well.

If your custom URL endpoint requires different headers, it must be specified in this property. To keep feature parity with the existing Snippet action, CXone adds the following headers.

{"Accept":"application/json", "Content-Type" :"application/x-www-form-urlencoded"}

Command

Only option is MakeRestRequest, which functions the same when using in a Snippet. Future development may offer addition commands that the Snippet action provides.

TimeOutInMilliSeconds Allows a timeout of the REST call to be specified and honored. Must be less than 90 seconds (90000 milliseconds).
Service Address Allows for a custom URL to be supplied, including ability to specify query parameters for a GET. Variable Substitution is also supported.

Output Variables

Variable Details
resultSet(out) Response from the your organization's provided endpoint in service address. In the Studio trace window it appears as Dynamic Object for display purposes. You can also pass this resultSet as-is into the header and parameters if needed.
errorArgList(out) Error conditions have an object like the REST proxy for compatibility. Supports DynamicData type.

Branches

Branch Details
OnThrottle Path taken when too many requests are executed within a short period of time. See limitations below for more details.
OnInvalidInput Path taken if invalid input is found or a timeout error occurs. Every parameter is validated when the script is saved.
OnFailure Path taken when any error or exception happens within the NICE CXone application executing the request.
OnError Path taken when the remote customer endpoint returns an http error code.
Default Path taken when the response is not received within 90 seconds of time.

Limitations

Limitations are imposed at tenant level so that one should not impact the other. Below are the limitations within the platform:

  • Response Format — only JSON response format is supported.
  • Retries on Failure — action handler will automatically try 2 times if failure is received before returning the response. Any http status code other than 2xx is retry-able.
  • Timeout — timeout will be as per your specification in the request and cannot be more than 90 seconds.
  • Max Response Size — the maximum response size allowed to be transferred is 32 KB, which is consistent with existing Snippet functionality.
  • Throttle Limit — throttle limit is defined by 2 parameters:
    • Max Concurrent Requests — 30 concurrent requests will be allowed as per existing Snippet functionality. However, these are asynchronous calls; the throughput achieved with 30 will be far more than the existing Snippet functionality.
    • In Queue Count — if the above max concurrent requests are reached, the system will queue up 5000 requests. It will pick as soon as the concurrency has bandwidth to take up more requests.
  • Circuit Breaker — if your specified URL is down or unreachable, such as getting too many failures on your request, CXone will back off (reduce) the execution for a certain period of time so that your specified URL can recover from the failure and is healthy to receive requests. Limits are identified below.
  • Back Off Time or Duration of Break — 30 seconds. If the failure rate is achieved, your requests will not execute for 30 seconds.
  • Minimum Throughput — 100. If the tenant is not executing the minimum number of requests, it will not restrict to not execute your requests even though the requests are failing.
  • Failure Rate — 50%. If 50% of the requests failed during 30 seconds, your requests will not be executed for the following 30 seconds. 30 seconds is a rolling window.

Other Options

You can replace external RESTful API requests currently completed in the Snippet action.