Go to Robotic Automation version 22.1 documentation

Robot Manager REST client component

A RESTful application, like Pega Robot Manager, uses standard verbs like get, post, put, delete, and so on to retrieve and send data to and from a remote server.

Use the RobotManagerRestClient component in Pega Robotic Automation to make a call to a REST API endpoint that Pega provides in a Pega Robot Manager environment. If the system returns data as a result of the REST API call, then you can retrieve this data and use it in automation. This component uses the JSON (JavaScript Object Notation) format to make the request and for output from the request.

When you add this component to an automation, the system places it on the Global tab of the component tray. This component must be global so other automations in the project can reference it. You can find this component in the Interaction Management section of the Pega Robot Studio toolbox.

To use this component, you supply parameters to the Robot Manager REST Client component before you execute methods against the targeted REST endpoint. The system presents these parameters for you to use and set in automations. Here is a summary of the available parameters:

InputParameters

Specifies input parameters using key value pairs. The system then uses these key value pairs to generate the JSON body for the request. Click this property to open the Input Parameter Editor where you specify the name and values for these inputs.

OutputParameters

Automatically generates the output parameters returned by the REST call by making a REST call with a valid URI, HTTP method, and input parameters. You can also manually add output parameters if you are unable to perform a REST call at this time.

The Output Parameter Editor includes the following fields.

Field Description

Server URI

Defines the endpoint used for the REST call.

HTTP Method

Specifies which HTTP method to use for the REST call. You can choose from the following options: GET, PUT, POST, DELETE, HEAD, PATCH, OPTIONS, CONNECT, and TRACE.

Input Method

Allows you to use the input parameters that you have already specified for the component or to provide raw input.

Output Parameters

Lists the output parameters that you added. Also lists the output parameters that the system returns when you test a REST call.

Raw Output

Displays the raw JSON output that the system returns with the REST call.

Use the Add and Remove buttons to add or remove output parameters from this list. You can also move the parameters up and down to modify the order in which they appear. The Clear button removes all output parameters.

Click Validate to tell the system to use the information in the Server Details section to generate the output parameters list. After the system generates the parameters list, make the REST call.

Click OK to save your settings and close the form. Click Cancel to close the form without saving settings.

Parameters

The following parameters are available:

Parameter

Definition

UriQueryparameters

Specifies input parameters using key value pairs. The system uses these parameters to generate the URI query string. Click this property to open a window where you can specify the name and values for these inputs.

After you define these input parameters, be sure to call the SetUriQueryWithParameters method. This method automatically sets the UriQueryString property.

Note: Call this method before you use any of the execute methods to invoke the REST call.

UriQueryString

Defines the part of the URI that contains parameters. Set this property to override the value of the UriQueryParameters property. Setting this property also overrides the URI query string that is set by the SetUriQueryWithParameters method.

Accept

Defines the accepted content type for the accept header. The default is application/json.

ContentType

Defines the request content type. The default is application/json.

CustomHeaders

Defines custom headers for the request as key value pairs. Click this property to open the Custom Header Editor window where you can define the custom headers.

HttpMethod

Defines the HTTP method for the request. You can choose from the following options: GET, PUT, POST, DELETE, HEAD, PATCH, OPTIONS, CONNECT, and TRACE.

ServerUriBase

Defines the base part of the URI for the REST endpoint that you are calling. This value comes from the CommonConfig.xml setting under the Robot Manager connection URL and allows the system to call the endpoint for the Pega server instance used for Robot Manager.

ServerUriPath

Defines the path and query part of the URI for the REST endpoint that you are calling.

ServerUriFull

Displays the full URI, which is ServerUriBase + ServerUriPath. You cannot modify this value.

UseRobotManagerConnection

This setting only applies when you do not start Pega Robot Runtime throughPega Robot Studio. There are Username and Password properties associated with this setting.

When running Pega Robot Runtime through Pega Robot Studio, the system uses basic authentication for communication with Robot Manager, using the username and password property values that you entered for the component.

If you are runningPega Robot Runtime stand-alone, and the UseRobotManagerConnection parameter is False, then basic authentication applies.

If you are running Pega Robot Runtime stand-alone and the UseRobotManagerConnection value is True, the system uses the authentication method defined in the CommonConfig.xml setting for the Robot Manager connection.

 

Methods

The following methods are available:

Method

Description

Return type

AddCustomHeader
(2 parameters)

Adds a custom header key value pair in an automation instead of having to define them ahead of time using the component’s properties.

This method has two input parameters, headerName and headerValue, which are both string parameters.

Not applicable

ClearCustomHeaders

Clears all of the custom headers in the automation that you defined in the component properties or were added using the AddCustomHeader method.

 

Not applicable

Execute
(3 parameters)

Executes the REST call. Use the string input parameter, requestBody, to enter a raw JSON request body.

This method has two output parameters, statusCode and responseBody. statusCode, returns the HTTP response code from the request. responseBody returns the raw JSON.

This method uses parameters defined in the response body instead of the input parameters defined for the component.

statusCode (int)

response Body (string)

ExecuteWithParameters
(2 parameters)

Executes the REST call using the settings that you defined in the RESTClient component.

This method has two output parameters, statusCode and responseBody. statusCode, returns the HTTP response code from the request. responseBody returns the raw JSON.

statusCode (int)

response Body (string)

ExecuteWithParameters
(x parameters)

Sets values for your input parameters during automation. It also gives you a value for each defined output parameter to use in automation.

This method displays in the method list for the component after you define output parameters.

This method has two other output parameters, statusCode and responseBody. statusCode, returns the HTTP response code from the request. responseBody returns the raw JSON.

statusCode (int)

response Body (string)

RemoveCustomHeader
(1 parameter)

Removes a specific custom header that you added using the AddCustomHeader method or by using the customHeaders property for the component.

This method has a string input parameter of headerName.

Not applicable

SetUriQueryWithParameters
(no parameters)

Call this method to set the URI query string using the parameters and values entered for the UriQueryParameters property.

result(string)

SetUriQueryWithParameters
(x parameters)

Sets the URI query string using the parameters entered in the UriQueryParameters property and allow you to set the values for these in automation.

This method has multiple inputs depending on how many parameters you add. The input type is string.

result(string)

 

Related information

Rest Client

JsonUtils Component

 


Privacy | Trademarks | Terms of Use | Feedback

Updated: 28 March 2024

© 2016 - 2024 Pegasystems Inc.  Cambridge, MA All rights reserved.

 

OpenSpan data classification label