You are here: Reference > Rule types > Service REST rules > Service REST form - Completing the Methods tab

Service REST form
Completing the Methods tab

  1. About 
  2. New 
  3. Service 
  4. Methods 
  5. History 
  6. More... 

Complete the Methods tab to identify the activity called by each method in this Service REST rule.

GET

In the Service Activity field, use the SmartPrompt to select the Service activity that provides the processing for this GET method. For example, when the request is using the GET method, the activity can get the current state of a work item.

In addition, when the Enable service SLA with fallback activity is selected on the Service tab, you can select a fallback activity for the response when the SLA fails. For example, the fallback activity can display a default offer to an ATM customer instead of an offer based on the particular customer's data. If you do not select a fallback activity, the default response is sent back.

The system uses the value you enter in the Page Class field as the Applies To key part of the activity. The system creates a page with the name provided in the Page Name field and passes it to the activity as the primary page. If the Page Name field is blank, the system passes an unnamed page to the activity.

If a parameter value is the same for every service request, you can set that parameter's value rather than requiring a client application to supply it in each request. For example, if a service activity starts a flow for a work item and the organization is always the same, specify the name of the organization on this tab.

Parameter values from the incoming request override values set on this tab.

GET Request tab

Use the Request tab to map data for the GET request.

Field

Description

HEADERS  
Name

Enter the external name of the header field.

Description

Describe the purpose of the header.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by the Map To Key field.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data be mapped at runtime.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, either select a property to hold the results of the function or leave this field blank, as appropriate for the function.
QUERY STRING  
Name

Enter the name of the input query string.

Description

Describe the purpose of the query string.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by the Map To Key field.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data be mapped at runtime.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, either select a property to hold the results of the function or leave this field blank, as appropriate for the function.

GET Response tab

Use the Response tab to specify how the service rule constructs the response that the Pega Platform sends in reply to the request. You can set up more than one response, based on conditions. You can also specify additional HTTP response codes to send with the response.

When no response is configured on this tab, at runtime the Pega Platformreturns one of the following HTTP response codes by default:

Field

Description

RESPONSE CONDITION To override any of those codes, specify a response on this tab. Define each condition with the following four fields:
Condition

Select one of the following conditions:

Default

Send this response when there are no errors to report. If you plan to set up more than one condition, configure the Default condition as the last one in the list. To send an HTTP response code other than 200, specify a different code for the Default condition in the HTTP Response Code field.

When

The system evaluates the when condition specified by the When Key field. If the condition is true, the system returns the response message data. If the condition is false, the system evaluates the next when condition rule in the list. If all listed when condition rules are false, it returns the default response data. Use this feature to extend the normal set of fatal error conditions that result in exceptions returned to the client, such as inappropriate inputs to the service activity or other tests you define.

Queue When

The system evaluates the when condition rule specified by the When Key field. If the condition evaluates to true, the system queues the service request and returns the queue item ID of the service request.
If you configure a Queue When condition, you must specify a request processor in the Request Processor field on the Service tab. For more information, see PDN article Configure a service to queue a failed service request for another attempt.

Mapping Error

If an error occurs while mapping incoming data from a request message to the clipboard, the service returns the specified response message data. If the list of response conditions does not include an entry for mapping errors, the Pega Platform returns the HTTP status code 500.

Security Error

If an error occurs while authenticating the client credentials, the Pega Platform returns the specified response message data. If the list of response conditions does not include an entry for security errors, the Pega Platform returns the HTTP status code 401.

Service Error

If a service error occurs, the system sends the specified response message data. If the list of response conditions does not include an entry for service errors, the Pega Platform returns a standard error message.

Tip: It is a best practice to configure the error conditions to ensure that the system notifies an administrator about the error.

When Name

Optional, but required if the Condition value is set to When or Queue When. Specify the name — second key part — of a when condition rule to evaluate for this condition. The system uses the first key part — the Applies To class — of the service activity as the first key part of the when condition rule.

Content Type

Select text/plain, text/html, or text/xml for the header in the outgoing message.

Select application/xml for the header when the request body is formatted in XML.

Select application/json for the header when the request body is formatted in JSON.

Status Code

Optional. Enter an HTTP status code to return to the external application with the response.

HEADER FIELDS

By default, the Pega Platform sets values for the REST headers Server, Cache-Control, Content-Type, Content-Length, and Date in the response. Additionally, if the Processing Mode in the service package is set to Stateful, the system sends the Requestor ID value automatically to the client application as a token, in a cookie with the prefix PegaRULES.

If the response is include a header other than the ones that are set by default, complete the fields in this section. The data type of a header field is String.

Name

Enter the external name of the header field.

Description

Enter a short description of the header field.

Map From

Specify the source or the type of source of the value in the Pega Platform .

  • Clipboard — Map from the page name or property on the clipboard specified by the Map From Key field.
  • Constant — The data is a fixed value.
  • If additional choices appear, they identify a custom function rule in a MapFrom library (Rule-Utility-Function). Review the function rule to determine what it does.
Map From Key

Specify the key to locating the property or rule in the source specified in the Map From field.

  • If the Map From value is Clipboard, enter the property name to which the data is mapped at runtime.
  • If the Map From value is a Rule-Utility-Function from a MapFrom library, enter or select property that holds the value pass to the custom function at runtime.
  • If the Map To value is Constant, enter the value of the constant, surrounded by double quote characters.
MESSAGE DATA

Use the fields in this section to define the data for the response. The data type of the message data is String.

Description

Enter a short description of the incoming string.

Map from

Specify the source or the type of source of the value in the Pega Platform:

  • Clipboard — The source is a property or a page on the clipboard.
  • Constant — The source is a fixed value that does not change.
  • JSON — The source is a stream of JSON data formatted by a Page or Page List property.
  • XML Stream — The source is a stream of XML data formatted by an XML Stream rule.
  • HTML Stream — The source is a stream of HTML data formatted by an HTML rule.
  • HTML Frame — The source is a stream of HTML data generated by the service activity.

If additional choices appear, they identify a custom function rule in a MapFrom library. Review the function rule to determine what it does.

Map from key

Specify the key to locating the property or rule in the source specified in the Map to field:

Clipboard

Enter the reference to the property.

If this is a Queue When mapping or the mapping for a service that processes service requests asynchronously, enter Param.pxQueueItemID. For information see PDN articles Configure a service to queue a failed service request for another attempt or Configure a service to process requests asynchronously.

Constant

Enter a literal text string. To include blank spaces in your text string, surround the string with double quotes.

JSON

Enter the reference to a Page or Page List property.

XML Stream

Enter either the Stream Name (second key part) of the appropriate XML Stream rule or a page name and stream name using the syntax PageName.StreamName. The page must be on the clipboard when the service rule runs for rule resolution to find the rule. If you specify the stream name only, the system uses the Page Class of this service rule (found on the Service tab) as the first key part of the HTML rule.

HTML Stream

Enter either the Stream Name (second key part) of the appropriate HTML rule or a page name and stream name using the syntax PageName.StreamName. (The page must be on the clipboard when the service rule runs for rule resolution to find the rule.) If you specify the stream name only, the system uses the Page Class of this service rule (on the Service tab) as the first key part of the HTML rule.

HTML Frame

Enter the name of the frame specified in the Show-HTML step of the service activity. Use this option to return data from activities that were originally written for interactive browser clients and use the Show-HTML method.

a Rule-Utility-Function from a MapFrom library

Either select the property that holds the value to be processed by the function at runtime or leave this field blank, as appropriate for the function.

POST

In the Service Activity field, use the SmartPrompt to select the Service activity that provides the processing for this POST method. For example, when the request is using the POST method, the activity can update the state of the work item to be Resolved-Completed.

In addition, when the Enable service SLA with fallback activity is selected on the Service tab, you can select a fallback activity for the response when the SLA fails. If you do not select a fallback activity, the default response is sent back.

The system uses the value you enter in the Page Class field as the Applies To key part of the activity. The system creates a page with the name provided in the Page Name field and passes it to the activity as the primary page. If the Page Name field is blank, the system passes an unnamed page to the activity.

If a parameter value is the same for every service request, you can set that parameter's value rather than requiring a client application to supply it in each request. For example, if a service activity starts a flow for a work item and the organization is always the same, specify the name of the organization on this tab.

Parameter values from the incoming request override values set on this tab.

POST Request tab

Use the Request tab to map data for the POST request.

Field

Description

HEADERS  
Name

Enter the external name of the header field.

Description

Describe the purpose of the header.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by the Map To Key field.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data be mapped at runtime.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, either select a property to hold the results of the function or leave this field blank, as appropriate for the function.
QUERY STRING  
Name

Enter the external name of the header field.

Description

Describe the purpose of the header.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by the Map To Key field.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data be mapped at runtime.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, either select a property to hold the results of the function or leave this field blank, as appropriate for the function.
MESSAGE DATA

Use the fields in this section to define the data for the response. The data type of the message data is String.

Description

Enter a short description of the incoming string.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by Map To Key field.
  • XML ParseRule — The incoming data is a stream of XML that must be parsed using the actions defined in a parse XML rule (an instance of the Rule-Parse-XML rule type).
  • JSON — The incoming data is a JSON formatted stream that must be mapped to a Page or a Page List property on the clipboard.
  • Delimited ParseRule — The incoming data is in a delimited format that must be processed by a delimited parse rule (an instance of Rule-Parse-Delimited).
  • Structured ParseRule — The incoming data has a fixed format with fixed length fields and must be processed by a structured parse rule.
  • HTML PostData — The incoming data value form the sending application is a stream of data from and HTML form that contains property key/value pairs.

If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.

Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data is to be mapped.
  • If the Map To value is XML Parse Rule, enter the Namespace name (second key part) and the Element Name name — third key part — of the appropriate Parse XML rule. Separate the Namespace from the Element name with a space using the syntax "NamespaceName ElementName" rather than "NamespaceName.ElementName." The system uses the Applies to class of this connector rule as the first key part of the parse rule.
  • If the Map To value is JSON, enter the property name to which the data is to be mapped. The property should be of mode Page or Page List.
  • If the Map To value is Delimited ParseRule, enter the Namespace and Record Type names (second and third key parts) of the appropriate delimited parse rule. The system uses the Applies To class of this service rule as the first key part of the parse rule.
  • If the Map To value is Structured ParseRule, enter the Record Type (third key part) of a structured parse rule. The system uses the Applies To class of this service rule as the first key to the parse rule.
  • If the Map To value is HTML PostData, leave this field blank. The name/value pairs in the string will be mapped to the parameter page of the service activity rather than the primary page.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, select or enter the property that holds the results of the custom function at runtime.

POST Response tab

Use the Response tab to specify how the service rule constructs the response that the Pega Platform sends in reply to the request. You can set up more than one response, based on conditions. You can also specify additional HTTP response codes to send with the response.

When no response is configured on this tab, at runtime the Pega Platform returns one of the following HTTP response codes by default:

Field

Description

RESPONSE CONDITION

To override any of those codes, specify a response on this tab. Define each condition with the following four fields:

Condition

Select one of the following conditions:

Default

Send this response when there are no errors to report. If you plan to set up more than one condition, configure the Default condition as the last one in the list. To send an HTTP response code other than 200, specify a different code for the Default condition in the HTTP Response Code field.

When

The system evaluates the when condition specified by the When Key field. If the condition is true, the system returns the response message data. If the condition is false, the system evaluates the next when condition rule in the list. If all listed when condition rules are false, it returns the default response data. Use this feature to extend the normal set of fatal error conditions that result in exceptions returned to the client, such as inappropriate inputs to the service activity or other tests you define.

Queue When

The system evaluates the when condition rule specified by the When Key field. If the condition evaluates to true, the system queues the service request and returns the queue item ID of the service request.
If you configure a Queue When condition, you must specify a request processor in the Request Processor field on the Service tab. For more information, see PDN article Configure a service to queue a failed service request for another attempt.

Mapping Error

If an error occurs while mapping incoming data from a request message to the clipboard, the service returns the specified response message data. If the list of response conditions does not include an entry for mapping errors, the Pega Platform returns the HTTP status code 500.

Security Error

If an error occurs while authenticating the client credentials, the Pega Platformreturns the specified response message data. If the list of response conditions does not include an entry for security errors, the Pega Platform returns the HTTP status code 401.

Service Error

If a service error occurs, the system sends the specified response message data. If the list of response conditions does not include an entry for service errors, the Pega Platform returns a standard error message.

Tip: It is a best practice to configure the error conditions to ensure that the system notifies an administrator about the error.

When Name

Optional, but required if the Condition value is set to When or Queue When. Specify the name — second key part — of a when condition rule to evaluate for this condition. The system uses the first key part — the Applies To class — of the service activity as the first key part of the when condition rule.

Content Type

Select text/plain, text/html, or text/xml for the header in the outgoing message.

Select application/xml for the header when the request body is formatted in XML.

Select application/json for the header when the request body is formatted in JSON.

Status Code

Optional. Enter an HTTP status code to return to the external application with the response.

HEADER FIELDS

By default, the Pega Platform sets values for the HTTP headers Server, Cache-Control, Content-Type, Content-Length, and Date in the response. Additionally, if the Processing Mode in the service package is set to Stateful, the system sends the Requestor ID value automatically to the client application as a token, in a cookie with the prefix PegaRULES.

If the response is include a header other than the ones that are set by default, complete the fields in this section. The data type of a header field is String.

Name

Enter the external name of the header field.

Description

Enter a short description of the header field.

Map From

Specify the source or the type of source of the value in the Pega Platform.

  • Clipboard — Map from the page name or property on the clipboard specified by the Map From Key field.
  • Constant — The data is a fixed value.
  • If additional choices appear, they identify a custom function rule in a MapFrom library (Rule-Utility-Function). Review the function rule to determine what it does.
Map From Key

Specify the key to locating the property or rule in the source specified in the Map From field.

  • If the Map From value is Clipboard, enter the property name to which the data is mapped at runtime.
  • If the Map From value is a Rule-Utility-Function from a MapFrom library, enter or select property that holds the value pass to the custom function at runtime.
  • If the Map To value is Constant, enter the value of the constant, surrounded by double quote characters.
MESSAGE DATA

Use the fields in this section to define the data for the response. The data type of the message data is String.

Description

Enter a short description of the incoming string.

Map From

Specify the source or the type of source of the value in the Pega Platform:

  • Clipboard — The source is a property or a page on the clipboard.
  • Constant — The source is a fixed value that does not change.
  • JSON — The source is a stream of JSON data formatted by a Page or Page list property.
  • XML Stream — The source is a stream of XML data formatted by an XML Stream rule.
  • HTML Stream — The source is a stream of HTML data formatted by an HTML rule.
  • HTML Frame — The source is a stream of HTML data generated by the service activity.

If additional choices appear, they identify a custom function rule in a MapFrom library. Review the function rule to determine what it does.

Map From Key

Specify the key to locating the property or rule in the source specified in the Map From field:

Clipboard

Enter the reference to the property.

If this is a Queue When mapping or the mapping for a service that processes service requests asynchronously, enter Param.pxQueueItemID. For information see PDN articles Configure a service to queue a failed service request for another attempt or Configure a service to process requests asynchronously.

Constant

Enter a literal text string. To include blank spaces in your text string, surround the string with double quotes.

JSON

Enter the reference to a Page or Page List property.

XML Stream

Enter either the Stream Name (second key part) of the appropriate XML Stream rule or a page name and stream name using the syntax PageName.StreamName. The page must be on the clipboard when the service rule runs for rule resolution to find the rule. If you specify the stream name only, the system uses the Page Class of this service rule (found on the Service tab) as the first key part of the HTML rule.

HTML Stream

Enter either the Stream Name (second key part) of the appropriate HTML rule or a page name and stream name using the syntax PageName.StreamName. (The page must be on the clipboard when the service rule runs for rule resolution to find the rule.) If you specify the stream name only, the system uses the Page Class of this service rule (on the Service tab) as the first key part of the HTML rule.

HTML Frame

Enter the name of the frame specified in the Show-HTML step of the service activity. Use this option to return data from activities that were originally written for interactive browser clients and use the Show-HTML method.

a Rule-Utility-Function from a MapFrom library

Either select the property that holds the value to be processed by the function at runtime or leave this field blank, as appropriate for the function.

PUT

In the Service Activity field, use the SmartPrompt to select the Service activity that provides the processing for this PUT method. For example, when the request is using the PUT method, the activity can create a new work item.

In addition, when the Enable service SLA with fallback activity is selected on the Service tab, you can select a fallback activity for the response when the SLA fails. If you do not select a fallback activity, the default response is sent back.

The system uses the value you enter in the Page Class field as the Applies To key part of the activity. The system creates a page with the name provided in the Page Name field and passes it to the activity as the primary page. If the Page Name field is blank, the system passes an unnamed page to the activity.

If a parameter value is the same for every service request, you can set that parameter's value rather than requiring a client application to supply it in each request. For example, if a service activity starts a flow for a work item and the organization is always the same, specify the name of the organization on this tab.

Parameter values from the incoming request override values set on this tab.

PUT Request tab

Use the Request tab to map data for the PUT request.

Field

Description

HEADERS  
Name

Enter the external name of the header field.

Description

Describe the purpose of the header.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by the Map To Key field.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data be mapped at runtime.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, either select a property to hold the results of the function or leave this field blank, as appropriate for the function.
QUERY STRING  
Name

Enter the name of the input query string.

Description

Describe the purpose of the query string.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by the Map To Key field.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data be mapped at runtime.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, either select a property to hold the results of the function or leave this field blank, as appropriate for the function.
MESSAGE DATA

Use the fields in this section to define the data for the response. The data type of the message data is String.

Description

Enter a short description of the incoming string.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by Map To Key field.
  • XML ParseRule — The incoming data is a stream of XML that must be parsed using the actions defined in a parse XML rule (an instance of the Rule-Parse-XML rule type).
  • JSON — The incoming data is a JSON formatted stream that must be mapped to a Page or a Page List property on the clipboard.
  • Delimited ParseRule — The incoming data is in a delimited format that must be processed by a delimited parse rule (an instance of Rule-Parse-Delimited).
  • Structured ParseRule — The incoming data has a fixed format with fixed length fields and must be processed by a structured parse rule.
  • HTML PostData — The incoming data value form the sending application is a stream of data from and HTML form that contains property key/value pairs.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data is to be mapped.
  • If the Map To value is XML Parse Rule, enter the Namespace name (second key part) and the Element Name name — third key part — of the appropriate Parse XML rule. Separate the Namespace from the Element name with a space using the syntax "NamespaceName ElementName" rather than "NamespaceName.ElementName." The system uses the Applies to class of this connector rule as the first key part of the parse rule.
  • If the Map To value is JSON, enter the property name to which the data is to be mapped. The property should be of mode Page or Page List.
  • If the Map To value is Delimited ParseRule, enter the Namespace and Record Type names (second and third key parts) of the appropriate delimited parse rule. The system uses the Applies To class of this service rule as the first key part of the parse rule.
  • If the Map To value is Structured ParseRule, enter the Record Type (third key part) of a structured parse rule. The system uses the Applies To class of this service rule as the first key to the parse rule.
  • If the Map To value is HTML PostData, leave this field blank. The name/value pairs in the string will be mapped to the parameter page of the service activity rather than the primary page.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, select or enter the property that holds the results of the custom function at runtime.

PUT Response tab

Use the Response tab to specify how the service rule constructs the response that the Pega Platform sends in reply to the request. You can set up more than one response, based on conditions. You can also specify additional HTTP response codes to send with the response.

When no response is configured on this tab, at runtime the Pega Platform returns one of the following HTTP response codes by default:

Field

Description

RESPONSE CONDITION

To override any of those codes, specify a response on this tab. Define each condition with the following four fields:

Condition

Select one of the following conditions:

Default

Send this response when there are no errors to report. If you plan to set up more than one condition, configure the Default condition as the last one in the list. To send an HTTP response code other than 200, specify a different code for the Default condition in the HTTP Response Code field.

When

The system evaluates the when condition specified by the When Key field. If the condition is true, the system returns the response message data. If the condition is false, the system evaluates the next when condition rule in the list. If all listed when condition rules are false, it returns the default response data. Use this feature to extend the normal set of fatal error conditions that result in exceptions returned to the client, such as inappropriate inputs to the service activity or other tests you define.

Queue When

The system evaluates the when condition rule specified by the When Key field. If the condition evaluates to true, the system queues the service request and returns the queue item ID of the service request.
If you configure a Queue When condition, you must specify a request processor in the Request Processor field on the Service tab. For more information, see PDN article Configure a service to queue a failed service request for another attempt.

Mapping Error

If an error occurs while mapping incoming data from a request message to the clipboard, the service returns the specified response message data. If the list of response conditions does not include an entry for mapping errors, the Pega Platform returns the HTTP status code 500.

Security Error

If an error occurs while authenticating the client credentials, the Pega Platform returns the specified response message data. If the list of response conditions does not include an entry for security errors, the Pega Platform returns the HTTP status code 401.

Service Error

If a service error occurs, the system sends the specified response message data. If the list of response conditions does not include an entry for service errors, the Pega Platform returns a standard error message.

Tip: It is a best practice to configure the error conditions to ensure that the system notifies an administrator about the error.

When Name

Optional, but required if the Condition value is set to When or Queue When. Specify the name — second key part — of a when condition rule to evaluate for this condition. The system uses the first key part — the Applies To class — of the service activity as the first key part of the when condition rule.

Content Type

Select text/plain, text/html, or text/xml for the header in the outgoing message.

Select application/xml for the header when the request body is formatted in XML.

Select application/json for the header when the request body is formatted in JSON.

Status Code

Optional. Enter an HTTP status code to return to the external application with the response.

HEADER FIELDS

By default, the Pega Platform sets values for the REST headers Server, Cache-Control, Content-Type, Content-Length, and Date in the response. Additionally, if the Processing Mode in the service package is set to Stateful, the system sends the Requestor ID value automatically to the client application as a token, in a cookie with the prefix PegaRULES.

If the response is include a header other than the ones that are set by default, complete the fields in this section. The data type of a header field is String.

Name

Enter the external name of the header field.

Description

Enter a short description of the header field.

Map From

Specify the source or the type of source of the value in the Pega Platform.

  • Clipboard — Map from the page name or property on the clipboard specified by the Map From Key field.
  • Constant — The data is a fixed value.
  • If additional choices appear, they identify a custom function rule in a MapFrom library (Rule-Utility-Function). Review the function rule to determine what it does.
Map From Key

Specify the key to locating the property or rule in the source specified in the Map From field.

  • If the Map From value is Clipboard, enter the property name to which the data is mapped at runtime.
  • If the Map From value is a Rule-Utility-Function from a MapFrom library, enter or select property that holds the value pass to the custom function at runtime.
  • If the Map To value is Constant, enter the value of the constant, surrounded by double quote characters.
MESSAGE DATA

Use the fields in this section to define the data for the response. The data type of the message data is String.

Description

Enter a short description of the incoming string.

Map From

Specify the source or the type of source of the value in the Pega Platform:

  • Clipboard — The source is a property or a page on the clipboard.
  • Constant — The source is a fixed value that does not change.
  • JSON — The source is a stream of JSON data formatted by a Page or Page List property.
  • XML Stream — The source is a stream of XML data formatted by an XML Stream rule.
  • HTML Stream — The source is a stream of HTML data formatted by an HTML rule.
  • HTML Frame — The source is a stream of HTML data generated by the service activity.

If additional choices appear, they identify a custom function rule in a MapFrom library. Review the function rule to determine what it does.

Map From Key

Specify the key to locating the property or rule in the source specified in the Map From field:

Clipboard

Enter the reference to the property.

If this is a Queue When mapping or the mapping for a service that processes service requests asynchronously, enter Param.pxQueueItemID. For information see PDN articles Configure a service to queue a failed service request for another attempt or Configure a service to process requests asynchronously.

Constant

Enter a literal text string. To include blank spaces in your text string, surround the string with double quotes.

JSON

Enter the reference to a Page or Page List property.

XML Stream

Enter either the Stream Name (second key part) of the appropriate XML Stream rule or a page name and stream name using the syntax PageName.StreamName. The page must be on the clipboard when the service rule runs for rule resolution to find the rule. If you specify the stream name only, the system uses the Page Class of this service rule (found on the Service tab) as the first key part of the HTML rule.

HTML Stream

Enter either the Stream Name (second key part) of the appropriate HTML rule or a page name and stream name using the syntax PageName.StreamName. (The page must be on the clipboard when the service rule runs for rule resolution to find the rule.) If you specify the stream name only, the system uses the Page Class of this service rule (on the Service tab) as the first key part of the HTML rule.

HTML Frame

Enter the name of the frame specified in the Show-HTML step of the service activity. Use this option to return data from activities that were originally written for interactive browser clients and use the Show-HTML method.

a Rule-Utility-Function from a MapFrom library

Either select the property that holds the value to be processed by the function at runtime or leave this field blank, as appropriate for the function.

DELETE

In the Service Activity field, use the SmartPrompt to select the Service activity that provides the processing for this DELETE method. For example, when the request is using the DELETE method, the activity can update the state of the work item to be Resolved-Rejected.

In addition, when the Enable service SLA with fallback activity is selected on the Service tab, you can select a fallback activity for the response when the SLA fails. If you do not select a fallback activity, the default response is sent back.

The system uses the value you enter in the Page Class field as the Applies To key part of the activity. The system creates a page with the name provided in the Page Name field and passes it to the activity as the primary page. If the Page Name field is blank, the system passes an unnamed page to the activity.

If a parameter value is the same for every service request, you can set that parameter's value rather than requiring a client application to supply it in each request. For example, if a service activity starts a flow for a work item and the organization is always the same, specify the name of the organization on this tab.

Parameter values from the incoming request override values set on this tab.

 

DELETE Request tab

Use the Request tab to map data for the DELETE request.

Field

Description

HEADERS 
Name

Enter the external name of the header field.

Description

Describe the purpose of the header.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by the Map To Key field.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data be mapped at runtime.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, either select a property to hold the results of the function or leave this field blank, as appropriate for the function.
QUERY STRING 
Name

Enter the name of the query string.

Description

Describe the purpose of the query string.

Map To

Specify the destination or the type of destination for the value in the Pega Platform:

  • Clipboard — Map to the page name or property on the clipboard specified by the Map To Key field.
  • If additional choices appear, they identify a custom function rule (Rule-Utility-Function rule type) in a MapTo library. Review the function rule to determine what it does.
Map To Key

Specify the key to locating the property or the rule in the destination specified in the Map To field:

  • If the Map To value is Clipboard, enter the property name to which the data be mapped at runtime.
  • If the Map To value is a Rule-Utility-Function from a MapTo library, either select a property to hold the results of the function or leave this field blank, as appropriate for the function.

DELETE Response tab

Use the Response tab to specify how the service rule constructs the response that the Pega Platform sends in reply to the request. You can set up more than one response, based on conditions. You can also specify additional HTTP response codes to send with the response.

When no response is configured on this tab, at runtime the Pega Platform returns one of the following HTTP response codes by default:

Field

Description

RESPONSE CONDITION

To override any of those codes, specify a response on this tab. Define each condition with the following four fields:

Condition

Select one of the following conditions:

Default

Send this response when there are no errors to report. If you plan to set up more than one condition, configure the Default condition as the last one in the list. To send an HTTP response code other than 200, specify a different code for the Default condition in the HTTP Response Code field.

When

The system evaluates the when condition specified by the When Key field. If the condition is true, the system returns the response message data. If the condition is false, the system evaluates the next when condition rule in the list. If all listed when condition rules are false, it returns the default response data. Use this feature to extend the normal set of fatal error conditions that result in exceptions returned to the client, such as inappropriate inputs to the service activity or other tests you define.

Queue When

The system evaluates the when condition rule specified by the When Key field. If the condition evaluates to true, the system queues the service request and returns the queue item ID of the service request.

If you configure a Queue When condition, you must specify a request processor in the Request Processor field on the Service tab. For more information, see PDN article Configure a service to queue a failed service request for another attempt.

Mapping ErrorIf an error occurs while mapping incoming data from a request message to the clipboard, the service returns the specified response message data. If the list of response conditions does not include an entry for mapping errors, the Pega Platform returns the HTTP status code 500.
Security ErrorIf an error occurs while authenticating the client credentials, the Pega Platform returns the specified response message data. If the list of response conditions does not include an entry for security errors, the Pega Platform returns the HTTP status code 401.
Service Error

If a service error occurs, the system sends the specified response message data. If the list of response conditions does not include an entry for service errors, the Pega Platform returns a standard error message.

Tip: It is a best practice to configure the error conditions to ensure that the system notifies an administrator about the error.

When Name

Optional, but required if the Condition value is set to When or Queue When. Specify the name — second key part — of a when condition rule to evaluate for this condition. The system uses the first key part — the Applies To class — of the service activity as the first key part of the when condition rule.

Content Type

Select text/plain, text/html, or text/xml for the header in the outgoing message.

Select application/xml for the header when the request body is formatted in XML.

Select application/json for the header when the request body is formatted in JSON.

Status Code

Optional. Enter an HTTP status code to return to the external application with the response.

HEADER FIELDS

By default, the Pega Platform sets values for the HTTP headers Server, Cache-Control, Content-Type, Content-Length, and Date in the response. Additionally, if the Processing Mode in the service package is set to Stateful, the system sends the Requestor ID value automatically to the client application as a token, in a cookie with the prefix PegaRULES.

If the response is include a header other than the ones that are set by default, complete the fields in this section. The data type of a header field is String.

Name

Enter the external name of the header field.

Description

Enter a short description of the header field.

Map From

Specify the source or the type of source of the value in the Pega Platform.

  • Clipboard — Map from the page name or property on the clipboard specified by the Map From Key field.
  • Constant — The data is a fixed value.
  • If additional choices appear, they identify a custom function rule in a MapFrom library (Rule-Utility-Function). Review the function rule to determine what it does.
Map From Key

Specify the key to locating the property or rule in the source specified in the Map From field.

  • If the Map From value is Clipboard, enter the property name to which the data is mapped at runtime.
  • If the Map From value is a Rule-Utility-Function from a MapFrom library, enter or select property that holds the value pass to the custom function at runtime.
  • If the Map To value is Constant, enter the value of the constant, surrounded by double quote characters.
MESSAGE DATA

Use the fields in this section to define the data for the response. The data type of the message data is String.

Description

Enter a short description of the incoming string.

Map From

Specify the source or the type of source of the value in the Pega Platform:

  • Clipboard — The source is a property or a page on the clipboard.
  • Constant — The source is a fixed value that does not change.
  • JSON — The source is a stream of JSON data formatted by a Page or Page List property.
  • XML Stream — The source is a stream of XML data formatted by an XML Stream rule.
  • HTML Stream — The source is a stream of HTML data formatted by an HTML rule.
  • HTML Frame — The source is a stream of HTML data generated by the service activity.

If additional choices appear, they identify a custom function rule in a MapFrom library. Review the function rule to determine what it does.

Map From Key

Specify the key to locating the property or rule in the source specified in the Map From field:

Clipboard

Enter the reference to the property.

If this is a Queue When mapping or the mapping for a service that processes service requests asynchronously, enter Param.pxQueueItemID. For information see PDN articles Configure a service to queue a failed service request for another attempt or Configure a service to process requests asynchronously.

Constant

Enter a literal text string. To include blank spaces in your text string, surround the string with double quotes.

JSON

Enter the reference to a Page or Page List property.

XML Stream

Enter either the Stream Name (second key part) of the appropriate XML Stream rule or a page name and stream name using the syntax PageName.StreamName. The page must be on the clipboard when the service rule runs for rule resolution to find the rule. If you specify the stream name only, the system uses the Page Class of this service rule (found on the Service tab) as the first key part of the HTML rule.

HTML Stream

Enter either the Stream Name (second key part) of the appropriate HTML rule or a page name and stream name using the syntax PageName.StreamName. (The page must be on the clipboard when the service rule runs for rule resolution to find the rule.) If you specify the stream name only, the system uses the Page Class of this service rule (on the Service tab) as the first key part of the HTML rule.

HTML Frame

Enter the name of the frame specified in the Show-HTML step of the service activity. Use this option to return data from activities that were originally written for interactive browser clients and use the Show-HTML method.

a Rule-Utility-Function from a MapFrom library

Either select the property that holds the value to be processed by the function at runtime or leave this field blank, as appropriate for the function.

About Service REST rules