Skip to main content

Creating the REST integration interface

5 Tasks

1 hr 30 mins

Visible to: All users Applies to: Pega Platform '25
Advanced
English

Scenario

The executive manager approves or rejects a truck after the vendor registers it. Upon approval, the city manager is assigned to rank the companies providing truck services for that city.

To retrieve a truck's rating, its VIN (Vehicle Identification Number) is provided to an external system. The average rating of all trucks belonging to a company determines the company's initial rating, which is subsequently overridden after each delivery is completed. The city manager ranks every truck following each delivery, directly impacting the truck company's overall rating. An updated truck rating is then sent back to the Global Truck Rating System (GTRS).

Pega Platform™ introduces enhanced tooling for REST integration, including Pega GenAI Blueprint™ for accelerated integration artifact generation, an improved Create REST Integration Wizard, and richer support for OpenAPI Specifications (OAS). This challenge guides you through selecting and implementing the optimal REST integration design that makes use of these features.

The following table provides the credentials you need to verify the solution:

Role User name Password
Admin admin@deliveryservice rules
Admin admin@gtrs rules

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Detailed Tasks

1 Identify design options

There are two design options to obtain the truck rating from GTRS:

  1. Use the Pega Platform out-of-the-box REST API (GET method) with a Data Page, as illustrated in the figure below. Data Pages offer improved integration with the Integration Designer and can be auto-generated via Pega GenAI Blueprint™ when an OpenAPI Specification (Swagger/OAS) file is uploaded during the Data & Integration step.
    Data-API
  2. Create a new Service-REST rule in the GTRS application and invoke it through a custom REST connector in the Delivery Service application. Pega Platform supports JSON Data Transforms as a dedicated mechanism for efficiently converting JSON payloads in this kind of custom connector configuration.

Similarly, there are two options to update the truck rating after delivery:

  1. Use the out-of-the-box REST API (PUT method) 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:​​​
Constellation-API
  1.  Create a new service in the GTRS application to update the truck rating. This provides full control over request and response structures, including complex embedded pages.

2 Evaluate design options

Review the pros and cons of each design option:

​​​​​​Get the truck rating

The following table describes the design options for retrieving the truck rating:

Design Pros Cons
Use out-of-the-box Pega Platform REST API {data GET methods}
  • Minimal development effort using built-in Pega Platform features.
  • Business logic is handled in the Data Page, and Pega Platform manages the request and response.
  • Pega GenAI Blueprint can auto-generate connectors and Data Pages from an OAS file, further reducing setup time.
  • Does not natively support value list, value group, or page group properties.
  • Limited customization of request and response structures.
Create a custom REST service in the GTRS application
  • Fully customizable request and response structures.
  • Supports complex Data Types including embedded pages and page lists.
  • Higher development effort.
  • Increased maintenance overhead, as changes must be coordinated across both applications.

 Update the truck rating

The following table describes the design options for updating the truck rating:

Design Pros Cons
Use out-of-the-box Pega Platform REST API {data PUT methods} with Savable Data Pages
  • Minimal development effort.
  • Native integration with Constellation UI for standard record updates.
  • Does not fully support updates to embedded page records (Page and Page List types).
  • Behavior is tightly coupled to Constellation UI flows.
Create a custom REST service in the GTRS application
  • Full control over request/response structure.
  • Supports updates to embedded pages and complex data structures.
  • Requires more development and ongoing maintenance effort.

3 Recommend the best design option

Review the following best practices for each design option:

Get the truck rating

Use the out-of-the-box Pega Platform REST API (GET) with a Data Page. This approach minimizes development effort and takes advantage of the Pega native data integration framework.

Update the truck rating

Use a custom REST service in the GTRS application. The out-of-the-box Pega APIs do not fully support updates to embedded pages (Page and Page List properties). A custom REST service provides the flexibility needed to handle these scenarios. JSON Data Transforms can be used within the custom connector configuration to streamline request and response payload mapping.

4 Identify required configuration tasks

To implement a solution according to the recommended design, you accomplish the following tasks:

  1. Create a REST connector in the Delivery Service application to fetch the truck rating from GTRS. Configure the Connect-REST rule with the appropriate request parameters (VIN, state) and response mapping using a Data Transform or JSON Data Transform.
  2. Create a custom Service-REST rule in the GTRS application to expose a service endpoint for updating the truck rating.
  3. Create a savable Data Page and corresponding REST connector in the Delivery Service application to invoke the GTRS update service after each delivery is completed.

5 Review solution details

Review the solution details for the best design options:

Apply the connector to get the initial truck rating

  1. Log in with admin@deliveryservice and switch to the MDC application to access the GTRS data type.
  2. In Dev Studio, create a new Data Page with a MDC-Data-GTRS class.
    You update the source for the Data Page in App Studio.
  3. After creating the Data Page, switch to App Studio, and then click Data to view the data objects and integrations.
  4. Open the GTRS data object and click on the Data pages tab.
    The newly created Data Page and its source are displayed.
  5. Click More > Configure source.
    For savable Data Pages, an additional Configure save options option is displayed.
  6. Select the system and configure the source as REST.
  7. 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.
  8. Refer to the Pega API documentation for the syntax to pass the parameters.
  9. 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:

ConnectREST_GTRS

The following figure is a snapshot of the Application Settings for BaseURL: 

Application settings for the Base URL.

The following figure is a snapshot of the authentication profile: 

Application settings for the GTRS-Auth-Profile.

You can map the response by using the response Data Transform on the Data Page, as shown in the following figure:

Configurable data srouces.

For more Pega API use cases, see City services example mobile app.

Update the truck rating

  1. 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.
  2. Log in with admin@deliveryservice and switch to the MDC application.
  3. 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.
  4. In App Studio, open the GTRS data object and click Configure save options.
  5. Configure a new source with REST and provide the service URL from the GTRS application.
  6. Set the required parameters and authentication.
  7. 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 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:

The generated settings for the service URL and authentication.

For more information, see Configuring a save plan for a Data Page in App Studio.



Available in the following mission:

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

Did you find this content helpful?

Want to help us improve this content?

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