Invoking a REST service rule
Call a REST service rule from an external system to invoke an action in your application or retrieve data from Pega Platform. For example, you can call a REST service to get the details of a case or assignment. You can specify the application context in which to run the API by using the application alias URL.
- To call a REST service rule, use
api
in the URL, and append the three-part key to the rule to the URL. Use the following syntax:https://appname.pegacloud.io/contextroot/api/packageName/version/resourcepathURL
For example: https://appname.pegacloud.io/prweb/api/application/v2/messages
Although you can still call a REST service by specifying/PRRestService
, as a best practice, useapi
. - To call an authenticated REST service in the context of the access group of a
specific application, specify the application alias in the endpoint URL:If your application does not have an application alias, the system uses the application identifier.
Note: You can use any servlet name except / PRRestService
for alias-based calls. You cannot invoke an application alias URL for unauthenticated services.- For non-multitenant environments, enter: http://host/prweb/<servletname>/app/appAlias/api/<service package>/...
- For multitenant environments, enter: http://host/prweb/<servletname>/app/appAlias/api/TenantHash/<service package>/...
- For calls without a servlet, enter: http://host/prweb/app/appAlias/api/<service package>/...
- For API service packages, enter: http://host/prweb/app/appAlias/api/...
For example: The following access groups are listed in your operator record. To run a service in the context of the AG2 access group, invoke the following application alias URL: http://host/prweb/<servletname>/app/app2/api
.Access group Application Application alias AG1 application1 app1 AG2 application2 app2 AG3 application3 app3 Result: The system chooses the first access group listed in the operator record that matches the application alias. The service then runs in the context of the selected access group.
Previous topic Automatically purging invocation history Next topic JSON data transforms