Skip to main content

Accessing a Pega application using the Pega API

2 Tarefas

5 min

Visível para: All users Applies to: Pega Platform '25
Intermediate
Data Integration
DX API
Inglês

Scenario

TGB HR department wants to modernize its employee evaluation process by allowing external systems to automatically create employee evaluation Cases in its Pega application. Currently, evaluation requests are initiated manually. To improve efficiency, TGB wants to enable the creation of Employee Evaluation Cases from an external service using the Pega API. This will allow other systems to trigger the evaluation process automatically. Configure the system to accept case creation requests from external services using secure API authentication.

To accomplish this, the following list includes the recommended tasks for completing this assignment. 

  • Configure OAuth 2.0 authentication for external service access
  • Set up secure API credentials for Case creation
  • Test external Case creation via Pega API
Nota: This exercise does not describe how you build the external application. The goal is to demonstrate the Pega API that needs to access your Pega application and the resulting JSON response.

The following table provides the credentials you need to complete the challenge.

Role User name Password
Senior System Architect SSA@TGB pega123!
Nota: This challenge does not have a demo video. Please refer to the Detailed Tasks for step-by-step instructions to complete the challenge.

Você deve iniciar sua própria instância da Pega para concluir este Challenge.

A inicialização pode leva até cinco minutos, portanto tenha paciência.

Detailed Tasks

1 Configure OAuth 2.0 authentication for external service access

  1. In the Pega instance for the challenge, enter the following credentials:
    1. In the User name field, enter SSA@TGB.
    2. In the Password field, enter pega123!.
  2. In the Dev Studio, click Create > Security > OAuth 2.0 Client Registration.
  3. In both the OAuth 2.0 Client Registration short description and Client name fields, enter EmployeeEvalutionAuthentication.
    Outh2.0 client registration creation form
  4. Click Create and open
    Nota: DX API V2 tests require authorization credentials. To generate a sample response to an endpoint call, you need an OAuth 2.0 Client Registration data instance.
  5. Configure the record:
    1. In the Supported grant types section, select Client credentials checkbox, and then select the Access group radio button.
    2. In the Access group field, enter or select HRAppsV2:Administrators.
      Supported grant types section
    3. In the Client Credentials section, click View & download.
      The client credentials for the DX API test.
    4. In the View & download window, click Download credentials.
      View and download credentials.
    5. Confirm that you downloaded the EmployeeEvalutionAuthentication_Client Credentials file on your machine.
    6. Close the View & download window.
  6. In the header of the record, click Save.
    Nota: After you save the record, the option to download the credentials is inactive.

2 Setup secure API credentials for Case creation and test the Pega API

  1. In Dev Studio, in the top-right corner, click Resources > Pega API to open the Pega API landing page.
    launching Pega API from the Dev Studio screen
  2. In the Service package list, select Constellation DX APIs.
  3. In the Application section, click Authorize.
    Authorize API's
  4. Open the EmployeeEvalutionAuthentication_ClientCredentials.txt file that you downloaded and saved in an earlier task. 
  5. In the Available authorizations window, in the ClientCredentials (OAuth2, clientCredentials) section, in the client_id and client_secret fields, enter or copy and paste the values from the text file.
  6. Click Authorize and confirm the authorization is successful.
    Authorized credentials screen
  7. Click Close to close the Available authorizations window.
  8. In the Case section, to the right of /cases, expand the POST /cases API endpoint to create a new Case.
    Pega API create cases api
  9. Click Try it out.
  10. In the REQUEST BODY, copy and paste the below JSON:

    {
    "caseTypeID": "TGB-HRApps-Work-EmployeeEvaluation",
    "parentCaseID": "",
    "processID": "pyStartCase",
      "content": {
        "Employee": {
            "pyFirstName": "Mario",
            "pyLastName": "Rossi",
            "Manager": "SSA@TGB",
            "Department": "Consulting"
          },
        "StartDate": "20300601",
        "EndDate": "20301231"
      },
      "pageInstructions": [],
      "attachments": []
    }

    Nota: Make a note of the employee details provided in the JSON.
  11. Click Execute to create a new case.

  12. Observe the resulting JSON response in the Response Body section and note the generated Case ID.

    Json response showing the case
    Nota: The JSON response can be difficult to read. To help make it more readable, try downloading a JSON viewer plugin for your browser. 


Disponível na seguinte missão:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Este conteúdo foi útil?

Quer nos ajudar a melhorar esse conteúdo?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice