Table of Contents

Article

Getting started with Pega API for Pega Platform 7

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 7 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 7 Platform. An example is provided of a Python script to access the GET /casetypes request URL that you obtain from the Pega API.

Add the Pega API role to your access group

To access the Pega API, add the Pega API role to your access group.

  1. Log in to the Pega 7 Platform as an Administrator or as any operator with permissions to modify access groups.
  2. In Designer Studio, click Operator > Access group.

    Navigating to the operator's access group

  3. Add the PegaRULES:PegaAPI roleto your access group and save the changes.

    Adding the Pega API role to your Access group

    Any operator using this access group can now call the Pega API REST services.

Configure HTTP or HTTPS on your Pega 7 Platform application server

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.

  1. Log in to the Pega 7 Platform as an Administrator.
  2. Enter the string "api" into the Designer Studio search field, press Enter, and filter by Exact Match.

    Searching for the API service package

  3. Open the API service package by clicking its name.

    Opening the API service package

  4. 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.

    Clearing the check box for TLS/SLS to use HTTP authentication

  5. 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.

  1. In Designer Studio, click Resources > Pega API.

    Navigating to the Pega API menu item

  2. On the Pega API landing page, click Show/Hide next to casetypes.

    Displaying case types in the Pega API

  3. Click GET.

    Displaying the GET method for case types

  4. Click Try it out! to test the GET /casetypes method.

    Trying out the GET method

  5. Enter your login credentials.

    Entering login credentials in the Windows Security window

    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:

      Request URL for the GET method

    • A list of case types:

      Response body for the GET method

    • A warning that you are not using HTTPS:

      Response headers for the GET method

That’s it! You have successfully used the Pega API with HTTP authentication.

Example of using a Python script to invoke the GET /casetypes request URL

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.

Using a Python script to access the request URL

The output lists the case type details that are specified in the Python script:

dcorp-dcorpApp-Work-MYWORK

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

Published August 12, 2015 — Updated December 3, 2018


96% found this useful

Related Content

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.