Exploring the DX API with Postman
9 Tasks
1 hr
Intermediate
Pega Platform '24.2
User Experience
Constellation
Low-Code App Development
English
Scenario
The
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 Pega DX API will help 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 Postman.
Note: Postman is a free, open-source API platform for building and testing APIs. For more information on Postman, see the Postman documentation overview.
The following table provides the credentials you need to complete the challenge:
Role | User name | Password |
---|---|---|
System Architect | Author@SL | pega123! |
Note: Your practice environment may support the completion of multiple challenges. As a result, the configuration shown in the challenge walkthrough may not match your environment exactly.
Challenge Walkthrough
Detailed Tasks
1 Update the TellUsMore_Service operator
- In the Pega instance for the challenge, enter the following credentials:
- In the User name field, enter Author@SL.
- In the Password field, enter pega123!
- Switch to
- In the header of Dev Studio, click Configure > Org & Security > Organization > Operators.
- In the list of operators, open the TellUsMore_Service operator.
- Click the Security tab.
- Click Update password, and then update the password to pega123!.
- Confirm that the selection for the Force password change on next login check box is clear.
- Click .
Note: You can verify the password change by logging into the TellUsMore application as the TellUsMore_Service operator with the password you entered. Be sure to log back in with the Author@SL credentials to complete the following tasks.
2 Configure OAuth 2.0 client registrations
Note: 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.
- In the navigation pane of Dev Studio, click Records > Security > OAuth 2.0 Client Registration.
- In the upper-right corner of the OAuth 2.0 Client Registration list, click Create.
- In both the OAuth 2.0 Client Registration short description and Client name fields, enter Sweet Life DX API Test.
- Click Create and open.
- Configure the record:
- In the Supported grant types section, clear the Client credentials checkbox, and then select the Password credentials checkbox.
- In the Identity mapping field, press the Down arrow key, and then select pyDefaultIdentityMappingForPasswordGrant.
- Select the Enable refresh token checkbox.
- In the Client Credentials section, click View & download.
- In the View & download window, click Download credentials.
- Confirm that you downloaded the Sweet Life DX API TEst_Client Credentials file on your machine.
- Close the View & download window.
- In the header of the record, click Save.
Note: After you save the record, the option to download the credentials is inactive.
3 Create the AllowedStartingFields Data Transform
- In the App Explorer, in the SL-TellUsMore-Work-Incident class, right-click Data Model, and then select Create > Data Transform.
- In the Label field, enter AllowedStartingFields.
- Click .
- In the Data Transform, set the .pyDescription target equal to "".
Note: You can add additional fields to the AllowedStartingFields Data Transform. For more information about adding fields while creating Cases in DX API v2, see Adding fields while creating Cases in Constellation DX API.
- Click Save.
4 Configure the Postman environment
- Download the DXAPIdefinition.postman_collection.zip file to your machine, and then open and extract it:
DXAPIdefinition.postman_collection.zip (72.08 KB)
- Extract the file from Step 1, and then save the DXAPIdefinition.postman_collection.json file to your machine.
- Access the Postman website, and then create a free account if you do not have one already.
- Create a Postman workspace named Sweet Life DX API Test for this challenge.
- In the Postman workspace, click DXAPIdefinition.postman_collection.json file.
The import begins automatically when you select the file.
, and then import - On the DX API definition, click the Variables tab.
- Open the Sweet Life DX API Test_ClientCredentials.txt file that you downloaded and saved in an earlier task.
- Modify the values in the Current value column so that they correspond to the information contained in the Sweet Life DX API Test_ClientCredentials (SLDXAPI_CC) file.
You must modify some information from the SLDXAPI_CC file slightly. The following table includes more information:Postman variable name Current value server Enter a partial URL from the SLDXAPI_CC file that includes the text from https to prweb.
For example, https://*******.pegacea.net/prweb.
The asterisks correspond to server-specific values in your SLDXAPI_CC file.baseUrl Enter a partial URL from the SLDXAPI_CC file that includes the text from https to prweb, and then append /api/application/v2.
For example, https://*******.pegacea.net/prweb/api/application/v2.
The asterisks correspond to server-specific values in your SLDXAPI_CC file.AccessTokenURL Enter the Access token endpoint value from the SLDXAPI_CC file ClientID Enter the Client ID from the SLDXAPI_CC file ClientSecret Enter the Client Secret from the SLDXAPI_CC file user TellUsMore_Service password pega123! OriginChannel Web - Click Save.
- Click the Authorization tab, and then review the details:
- Confirm that value in the Auth Type list is OAuth 2.0.
- Confirm that that value in the Token list is Available tokens.
- In the Configure New Token section, view the value in the Password field, and then confirm the value is {{password}}.
- Click Save if you have made updates.
- On the Authorization tab, attempt to generate a new token and verify that the authentication configuration is successful by clicking Get New Access Token.
After Postman authorizes the information you entered, a screen with your new access token is displayed. - Click Use Token to save the new token to your authorization profile.
Postman updates the token associated with the authorization profile.
5 Create a new Incident Case
- In the navigation pane of Postman, expand the cases folder, and then click Create new Incident - success.
- Click the Body tab, and then enter the following JSON code:
{
"content": {
"pyDescription": "Description"
},
"caseTypeID": "SL-TellUsMore-Work-Incident",
"parentCaseID": ""
} - Click Send to send the DX API request.
- Toward the bottom of the request page, analyze the JSON response data objects returned by the DX API:
- Review the caseInfo object and note the case ID.
- Review the relatedCaseTypes object.
- Review the assignments object.
The assignments object in the API response provides information about the Assignments created as part of the Case. It can include details such as the Assignment ID, the name of the assignee, the deadline for completion, and any associated data or attachments. - Review the availableChildCaseTypes object.
- Review the availableActions object.
The availableActions object that returns in the response of Create DX API is a list of Actions that users can perform on the created work object. These Actions are defined in the Case Type and can include options such as submitting the work object, saving it as a draft, or canceling it. - Review the stages section:
In Pega DX API, the stages object in the response for Case creation refers to the Stage of the Case where the newly created Case currently resides. A Stage in Pega Platform™ represents a logical division of a Case where a specific set of Actions or Tasks are performed. Each Stage typically has a set of Steps or Assignments that must be completed before the Case can move on to the next Stage. When you create a Case with the Pega DX API, the response includes a Stage object that provides information about the current Stage of the Case. This object might include properties such as the Stage name, ID, status, and other details about the current Stage. This information can be useful for tracking the progress of the Case and determining what Tasks or Assignments need to be completed before the Case can move on to the next Stage.
- Review the caseInfo object and note the case ID.
- In the nextAssignmentInfo object, copy the Assignment ID returned by the DX API (for example, ASSIGN-WORKLIST SL-TELLUSMORE-WORK I-1!CREATEFORM_DEFAULT) for the next task.
- Return to App Studio, preview the application, and then open the TellUsMore - BO Portal.
- Click Incidents, and then confirm that the newly created Case is displayed on the landing page.
6 Get Assignment details
- In the navigation pane of Postman, expand the assignments > {assignmentsID} folder path.
- Open the Get first assignment details request.
- In the central work pane, click the Params tab, and then modify the query param values:
- In the viewType row, enter page.
- Leave the pageName row empty.
- In the assignmentID row, enter the value returned in the nextAssignment object from the new Case call that you copied in Task 5, step 5.
For example, ASSIGN-WORKLIST SL-TELLUSMORE-WORK I-1!CREATEFORM_DEFAULT.
- Click Save, and then click .
- Investigate the JSON response object, and then copy the details of the submit object for the next task (for example, ASSIGN-WORKLIST SL-TELLUSMORE-WORK I-1!CREATEFORM_DEFAULT).
7 Use the assignments DX API endpoint to Get submit action details
- In the navigation pane of Postman, expand the assignments > {assignmentID} > actions > {actionID} folder path.
- Open the Get submit action details request.
- In the central work pane, click the Params tab, and then modify the query param values:
- Leave the viewType row empty.
- In the excludeAdditionalActions row, enter true.
- In the assignmentID row, enter the value from the submit object from Task 6, step 5 (for example, ASSIGN-WORKLIST SL-TELLUSMORE-WORK I-1!CREATEFORM_DEFAULT).
- In the actionID row, enter DetermineCategory.
- Click Save, and then click Send.
- Review the JSON response object.
- In the response, click the Headers tab, and then copy the etag value for the next task.
8 Perform a Submit Action
- In the navigation pane of Postman, expand the assignments > {assignmentID} > actions > {actionID} folder path.
- Open the Submit first assignment request file.
- In the central work pane, open the Params tab, and then modify the query param values:
- In the viewType row, enter none.
- In the assignmentID row, enter the value from the submit object that you copied in Task 5, step 5. (for example, ASSIGN-WORKLIST SL-TELLUSMORE-WORK I-1!CREATEFORM_DEFAULT).
- In the actionID row, enter DetermineCategory.
- Click the Headers tab, and then in the if match row, enter the value from the etag object that you copied in Task 6, step 6.
- Click the Body tab, and then enter the following JSON request code:
{
"content": {
"IncidentType": "Product faulty or unsafe",
"IncidentSubType": "Product not as described"
}
} - Click Save, and then click Send.
- Review the JSON response object, and then confirm that the request was successful.
- Return to App Studio, preview the application, and then open the TellUsMore - BO Portal.
- Confirm that the Incidents landing page contains values the Incident Type and Incident SubType fields.
9 Create a new product over DX API
- Return to Postman.
- In the navigation pane of Postman, expand the data > {data_view_ID} folder path.
- Open the Create Product request.
- In the central work pane, click the Params tab, and in the data_view row, enter D_ProductSavable.
- Click the Body tab, and then enter the following JSON code:
{
"data": {
"Name":"Shocker",
"Category":"20b3b6c4-d7d5-4516-a4ed-4cda31ddc5da",
"SKU":"32491"
}
} - Click Save, and then click Send.
- Review the JSON response object, noting the Category, Name, pyGUID, and SKU fields.
- Return to App Studio, and then click Data > Product > Records.
- Confirm that the Shocker product is included in the list of Product records.
Confirm your work
Your work has been confirmed as part of the steps in the Detailed Tasks section of this challenge.
This Challenge is to practice what you learned in the following Module:
Available in the following mission:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?