The Pega API enables you to quickly implement client and mobile applications by using built-in Pega REST services. It includes case, assignment, and data APIs that let you leverage your Pega Platform applications.
This quick start tutorial provides a hands-on experience with the Pega API through testing some of the built-in Pega API REST services for the Pega Platform. An example is provided of a Python script to access the GET /casetypes request URL that you obtain from the Pega API.
To access the Pega API, add the Pega API role to your access group.
- Log in to the Pega Platform as an Administrator or as any operator with permissions to modify access groups.
In Designer Studio, click.
Add the PegaRULES:PegaAPI roleto your access group and save the changes.
Any operator using this access group can now call the Pega API REST services.
The Pega API REST services can be invoked by using HTTP or HTTPS. Although the use of secure HTTPS (TLS 1.2) is recommended for test and production environments, this tutorial uses HTTP.
- Log in to the Pega Platform as an Administrator.
Enter the string "api" into the Designer Studio search field, press Enter, and filter by Exact Match.
Open the API service package by clicking its name.
On the Context tab of the service package rule form, clear the Use TLS/SSL (REST only) check box to use HTTP to test the Pega API REST services.
- Save the service package.
Test the Pega API REST services
After enabling the Pega API role and configuring HTTP, you can test the Pega API REST services.
In Designer Studio, click.
On the Pega API landing page, click Show/Hide next to casetypes.
Click Try it out! to test the GET /casetypes method.
Enter your login credentials.
The server returns a JSON-formatted response and provides the following information:
A request URL that you can access directly from any HTTP client, browser, WGET command line, Python script, Java program, or an Internet of Things device of your choice:
A list of case types:
- A warning that you are not using HTTPS:
That’s it! You have successfully used the Pega API with HTTP authentication.
You can use a Python script to access the GET /casetypes request URL that you obtained from the Pega API to list some of the case type details such as ID, status, and urgency. The following figure shows the code in a Python 2.7 client that uses the Pega API with a third-party library called Requests.
The output lists the case type details that are specified in the Python script:
ID: DCOR-DCORPAPP-WORK O-5, STATUS: New, URGENCY: 10
ID: DCOR-DCORPAPP-WORK O-6, STATUS: New, URGENCY: 10
ID: DCOR-DCORPAPP-WORK O-7, STATUS: New, URGENCY: 10