Accessing a Pega application using the Pega API
2 Tarefas
5 min
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
The following table provides the credentials you need to complete the challenge.
| Role | User name | Password |
|---|---|---|
| Senior System Architect | SSA@TGB | pega123! |
Detailed Tasks
1 Configure OAuth 2.0 authentication for external service access
- In the Pega instance for the challenge, enter the following credentials:
- In the User name field, enter SSA@TGB.
- In the Password field, enter pega123!.
- In the Dev Studio, click Create > Security > OAuth 2.0 Client Registration.
- In both the OAuth 2.0 Client Registration short description and Client name fields, enter EmployeeEvalutionAuthentication.
- 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.
- Configure the record:
- In the Supported grant types section, select Client credentials checkbox, and then select the Access group radio button.
- In the Access group field, enter or select HRAppsV2:Administrators.
- In the Client Credentials section, click View & download.
- In the View & download window, click Download credentials.
- Confirm that you downloaded the EmployeeEvalutionAuthentication_Client Credentials file on your machine.
- Close the View & download window.
- 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
- In Dev Studio, in the top-right corner, click Resources > Pega API to open the Pega API landing page.
- In the Service package list, select Constellation DX APIs.
- In the Application section, click Authorize.
- Open the EmployeeEvalutionAuthentication_ClientCredentials.txt file that you downloaded and saved in an earlier task.
- 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.
- Click Authorize and confirm the authorization is successful.
- Click Close to close the Available authorizations window.
- In the Case section, to the right of /cases, expand the POST /cases API endpoint to create a new Case.
- Click Try it out.
- 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. -
Click Execute to create a new case.
-
Observe the resulting JSON response in the Response Body section and note the generated Case ID.
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:
Quer nos ajudar a melhorar esse conteúdo?