Creating the REST integration interface
5 Tasks
1 hr 30 mins
Advanced
Pega Platform '23
English
Scenario
The executive manager approves or rejects the truck after the vendor registers the truck. If approved, the city manager is assigned to rank the companies that will provide truck services for that city.
To retrieve a truck's rating, provide its VIN to an external system. The average rating of all trucks belonging to that company becomes the initial rating of the company. The Global Truck Rating System (GTRS), a centralized truck rating system, will provide the rating for a given VIN belonging to a state. The company's initial rating is overridden after every delivery is completed. The city manager will rank every truck after delivery, which impacts the truck company's rating. The average of all truck ratings will be the rating of the truck company. An update of the truck rating will be sent to GTRS.
The following table provides the credentials you need to verify the solution:
Role | User name | Password |
---|---|---|
Admin | admin@deliveryservice | rules |
Admin | admin@gtrs | rules |
Detailed Tasks
1 Identify design options
There are two design options to obtain the rating from GTRS:
- Use the out-of-the-box data API and data pages to obtain the truck rating, as shown in the following figure:
- Create new Service-REST in the GTRS and invoke the custom service using a connector
Similarly, there are two options to update the truck rating after delivery:
- Use the out-of-the-box Constellation APIs to update an existing record. The out-of-the-box API uses savable data pages to update or create a new record, as shown in the following figure:
- Create a new service in the GTRS application to update the truck rating.
2 Evaluate design options
Review the pros and cons of each design option.
Get the truck rating
The following table describes the design options to retrieve the truck rating:
Design | Pros | Cons |
---|---|---|
Use out-of-the-box Pega Platform™ REST API {data GET methods} |
|
|
Create a custom REST service in the GTRS application |
|
|
Update the truck rating
The following table describes the design options to update the truck rating:
Design | Pros | Cons |
---|---|---|
Use out-of-the-box Pega Platform REST API {data PUT methods} |
|
|
Create a custom REST service in the GTRS application |
|
|
3 Recommend the best design option
Review the following best practices for each design option.
Get the truck rating
Use the Pega Platform out-of-the-box REST API call as it does not require a lot of development effort and does not need to customize the response.
Update the truck rating
To update the truck rating, use the custom REST service because the out-of-the-box Pega APIs do not support embedded page updates.
4 Identify required configuration tasks
To implement a solution, according to the recommended design, you accomplish the following tasks:
- Create a connector to fetch the truck rating. Configure the REST connector with a request and response.
- Create a REST service in the GTRS application to update the truck rating.
- Create a connector in the Delivery service application to update the truck rating. Configure the REST connector with a request and response.
5 Review solution details
Review the solution details for the best design options:
Apply the connector to get the initial truck rating
- Log in with admin@deliveryservice and switch to the MDC application to access the GTRS data type.
- In Dev Studio, create a new Data Page with a MDC-Data-GTRS class.
You update the source for the Data Page in the App Studio. - After creating the Data Page, switch to App Studio, and then click Data to view the data objects and integrations.
- Open the GTRS data object and click on the Data pages tab.
The newly created Data Page and its source is displayed. - Click More > Configure source.
For savable Data Pages, an additional Configure save options option is displayed. - Select the system and configure the source as REST.
- Enter the endpoint URL for the out-of-the-box data API and mention the Data Page that gives the truck rating (D_GTRSTruckRating) –
hosturl/data/data_page
. - Refer to the Pega API documentation for the syntax to pass the parameters.
- Configure the authentication information and click Initialize call.
The application settings for the URL and the authentication are generated for the connector.
The following figure is a snapshot of the GTRS Connect-REST Rule:
The following figure is a snapshot of Application Settings for BaseURL:
The following figure is a snapshot of the authentication profile:
You can map the response by using the response Data Transform on the Data Page, as shown in the following figure:
For more Pega API use cases, see City services example mobile app.
Update the truck rating
- Log in with admin@gtrs to create a service to update the truck rating.
You can use savable Data Pages to update the rating for a truck in the service activity. - Log in with admin@deliveryservice and switch to the MDC application.
- Create a savable Data Page in Dev Studio to update the truck rating in the GTRS application.
Savable Data Pages can be used to invoke the truck rating service. - In App Studio, open the GTRS data object and click Configure save options.
- Configure a new source with REST and provide the service URL from the GTRS application.
- Set the required parameters and authentication.
- In the next step, provide the request and response, and then save the Data Page.
You can verify the configurations in Dev Studio.
The following figure shows the The Update rating savable Data Page:
The system generates the application settings for the service URL and authentication, as shown in the following figure of the first API:
For more information, see Configuring a save plan for a Data Page in App Studio.
Confirm your work
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?