Exploring the DX API
1 Task
30 mins
Scenario
The Pega Digital Experience (DX) API is a set of model-driven REST API endpoints that help you programmatically view, create, and update Cases and Assignments. Understanding the messages that are transmitted between a Constellation application and the Pega DX API helps you troubleshoot issues that arise during the application development process.
To better understand the relationship between Constellation applications and the DX API, your challenge is to generate several Case-related DX API calls to Sweet Life's Incident Case Type using Bruno.
The following table provides the credentials you need to complete the challenge:
| Role | User name | Password |
|---|---|---|
| Solution Builder | Author@SL | pega123! |
After completing this challenge, you should be able to:
- Configure an OAuth 2.0 Client Registration for the Password credentials grant.
- Create a Data Transform to define allowed starting fields.
- Configure a Bruno environment with OAuth 2.0 authentication.
- Create a new Case using the DX API.
- Retrieve Assignment details through the DX API.
- Retrieve submit action details through the DX API.
- Perform a submit action through the DX API.
Detailed Tasks
1 Exploring the DX API
Use the technical documentation linked in the Journey map above to complete the assigned tasks. The technical documentation might have more information than you need to complete the tasks.
Acceptance criteria
Task 1: Configure the OAuth 2.0 Client Registration
- An OAuth 2.0 Client Registration is created with the following configuration:
Field Value Short description Sweet Life DX API Test Supported grant types Password credentials Identity mapping pyDefaultIdentityMappingForPasswordGrant Refresh token Enabled - The client credentials are downloaded and saved locally.
Task 2: Create the AllowedStartingFields Data Transform
- A Data Transform named AllowedStartingFields is created in the
SL-TellUsMore-Work-Incidentclass with the following configuration:Target Value .pyDescription""
Task 3: Configure the Bruno environment
- The DXAPIdefinition_collection.zip file is downloaded and extracted, and the DXAPIdefinition_collection.json file is saved locally.
DXAPIdefinition_collection.zip (61.46 KB)
- The DXAPIdefinition_collection.json file is imported into Bruno.
- On the Variables tab under the DX API Definition, the following values are configured in the Current value column:
Variable Value serverPartial URL from the credentials file from https to prweb (for example, https://******.pegaacademy.net/prweb) baseUrlPartial URL from the credentials file from https to prweb, appended with /api/application/v2(for example, https://******.pegaacademy.net/prweb/api/application/v2)AccessTokenURLAccess token endpoint value from the credentials file ClientIDClient ID from the credentials file ClientSecretClient Secret from the credentials file userTellUsMore_Service passwordpega123! OriginChannelWeb - On the Auth tab, the following is confirmed:
- Auth Type is set to OAuth 2.0.
- Grant Type is set to Password Credentials.
- Access Token URL is set to {{AccessTokenURL}}.
- Username is set to {{user}}.
- Password is set to {{password}}.
- Client ID is set to {{ClientID}}.
- Client Secret is set to {{ClientSecret}}.
- Add Credentials to is set to Basic Auth Header.
- Token Source is set to Access Token.
- Add token to is set to Headers.
- is clicked and authentication is verified as successful.
- is selected to save the new token to the authorization profile.
Task 4: Create a new Incident Case
- In Bruno, navigate to the cases folder under the DX API Definition and open the Create new Incident - success request.
- The request is executed with the following request body:
<code>{
"content": { "pyDescription": "Description" },
"caseTypeID": "SL-TellUsMore-Work-Incident",
"parentCaseID": ""
}</code> - The response objects
caseInfo,relatedCaseTypes,assignments,availableChildCaseTypes,availableActions, andstagesare reviewed. - The Assignment ID is copied from
nextAssignmentInfoin the response. - The new Case is visible in the TellUsMore – BO Portal under Incidents.
Task 5: Get Assignment details
- In Bruno, expand the assignments > {assignmentsID} folder under the DX API Definition and open the Get first assignment details request.
- The request is executed with the following parameters:
Parameter Value viewTypepage pageName(empty) assignmentID(Assignment ID from Task 4) - In the JSON response, the
submitobject is located by navigating toassignments > actions > links > submitand the details are copied (for example, ASSIGN-WORKLIST SL-TELLUSMORE-WORK I-1!CREATEFORM_DEFAULT).
Task 6: Get submit action details
- In Bruno, expand the assignments > {assignmentID} > actions > {actionID} folder under the DX API Definition and open the Get submit action details request.
- On the Params tab, the following query parameter values are configured:
Parameter Value viewType(empty) excludeAdditionalActionstrue assignmentID(submit object value from Task 5, for example, ASSIGN-WORKLIST SL-TELLUSMORE-WORK I-1!CREATEFORM_DEFAULT) actionIDDetermineCategory - The request is sent and the JSON response object is reviewed.
- On the Headers tab of the response, the
etagvalue is copied for use in the next task.
Task 7: Perform a submit action
- In Bruno, expand the assignments > {assignmentID} > actions > {actionID} folder under the DX API Definition and open the Submit first assignment request.
- On the Params tab, the following query parameter values are configured:
Parameter Value viewTypenone assignmentID(submit object value from Task 5, for example, ASSIGN-WORKLIST SL-TELLUSMORE-WORK I-1!CREATEFORM_DEFAULT) actionIDDetermineCategory - On the Headers tab, the
if-matchrow is set to theetagvalue copied from Task 6. - On the Body tab, the following JSON request body is entered:
<code>{
"content": {
"IncidentType": "Product faulty or unsafe",
"IncidentSubType": "Product not as described"
}
}</code> - The request is sent and the JSON response object is reviewed and confirmed as successful.
- In the TellUsMore – BO Portal, the Incidents landing page confirms that the Incident Type and Incident SubType fields are populated with the submitted values.
Directions
- Create a new OAuth 2.0 Client Registration named Sweet Life DX API Test, configure the grant type, identity mapping, and refresh token settings as detailed in the Acceptance criteria, and download the credentials.
- Create a new Data Transform named AllowedStartingFields in the
SL-TellUsMore-Work-Incidentclass and configure the target as detailed in the Acceptance criteria. - Download and extract the DXAPIdefinition_collection.zip file, import the DXAPIdefinition_collection.json file into Bruno, configure the Variables tab using the Sweet Life DX API Test_ClientCredentials.txt file, confirm the Auth tab settings, and obtain and apply a new access token as detailed in the Acceptance criteria.
- Navigate to the cases folder under the DX API Definition in Bruno, open the Create new Incident - success request, send the request body as detailed in the Acceptance criteria, review the response objects, and copy the Assignment ID from
nextAssignmentInfo. - Expand the assignments > {assignmentsID} folder under the DX API Definition in Bruno, open the Get first assignment details request, configure the parameters as detailed in the Acceptance criteria, send the request, and copy the
submitobject details fromassignments > actions > links > submitin the JSON response. - Expand the assignments > {assignmentID} > actions > {actionID} folder under the DX API Definition in Bruno, open the Get submit action details request, configure the Params tab as detailed in the Acceptance criteria, send the request, and copy the
etagvalue from the Headers tab of the response. - Expand the assignments > {assignmentID} > actions > {actionID} folder under the DX API Definition in Bruno, open the Submit first assignment request, configure the Params and Headers tabs, enter the Body as detailed in the Acceptance criteria, send the request, and verify the Incident Type and Incident SubType in the TellUsMore – BO Portal.
Want to help us improve this content?