Skip to main content

Creating the REST integration interface

5 Tasks

30 mins

Visible to: All users
Advanced Pega Platform 8.8 English
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Scenario

As opposed to external hotel contacts logging into the Booking application to indicate the number of rooms to reserve for an event, FSG wants those contacts to log in to the Pega Cloud™-hosted Hotel Proxy application. The Hotel Proxy application’s Rooms Request case are created by the Hotel application. The Hotel Proxy application’s Rooms Request case relays the number of reserved rooms to the Hotel application.

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

Role User name Password
Admin admin@HotelDevOnly rules
Admin admin@Hotel rules
Admin admin@HotelProxy 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

FSG does not want the Hotel contact to access the internal Hotel application. As a result, only the required room request goes to the Hotel Proxy application, which is accessible to Hotel contacts to confirm the availability of the rooms.

The interface allows the Hotel application to create a Rooms Request Proxy case in the Hotel Proxy application for every Rooms Request case in the Hotel application. The Hotel Proxy application allows a hotel contact to confirm the number of rooms reserved in the Rooms Request Proxy case. The interface then allows the Hotel Proxy application to send the number of rooms reserved to the originating Rooms Request case in the Hotel application.

The solution can be implemented by using one of the following options:

Option 1:

Have a common data type between hotel and hotel proxy application which holds the required rooms request data. This data will be referred by both hotel and hotel proxy case with a data reference pattern. 

Use the out-of-the-box Pega Platform™ REST API {cases POST and PUT methods} to establish a communication channel between Hotel and Hotel Proxy applications.

The following is an example of the POST JSON for creating a Rooms Request Proxy case in the Hotel Proxy application:

{ "caseTypeID": "FSG-HotelProxy-Work-RoomsRequestProxy", "pzLoadTime": "December 26, 2022 10:55:03 PM EST", "content": { "RoomsRequest": { "RoomsRequestId": "edb90443-0846-4aaa-a03c-0936af6d072c" } }, "pxCreateOperator": "COE@FSG", "pxCreateDateTime": "2022-12-27T03:55:03.701Z", "processID": "pyStartCase", "pxCreateSystemID": "pega", "pxCreateOpName": "COE" }

The following is an example of the PUT JSON for updating a Rooms Request Proxy case in the Hotel Proxy application:

{ "pxCreateOperator": "admin@hotelproxy", "pxCreateDateTime": "2022-12-27T03:59:16.262Z", "pxCreateSystemID": "pega", "pxDPParameters": { "LastSaved": "20221227T035547.616 GMT", "ActionID": "ResolveCase", "ID": "FSG-BOOKING-WORK ROOM-1001" }, "pxCreateOpName": "admin" }

Note: Do not just copy and paste the example text into separate text files. First, use JSONLint to verify and format the JSON correctly. Then, copy and paste the corrected text into two separate text files.

Use savable data pages to create proxy case, update case and it's rooms request data.

Required integration connectors are generated through APP STUDIO

End point URL's are maintained through configuration sets, application settings. 

Option 2:

Create a REST service in the Hotel Proxy application to create a proxy case for all the incoming room requests from the Hotel application. Create a REST service in the Hotel application to update confirmed rooms on the Rooms Request case for all the incoming requests from Hotel Proxy application.

2 Evaluate design options

​​​​​​

Design Pros Cons
Use out-of-the-box Pega Platform REST API {cases POST and PUT methods}
  • Leverages out-of-the-box Pega Platform feature with minimal development effort
  • Reusable shared interface component between Hotel and Hotel Proxy applications
  • Need to use Pega Platform-provided response; not possible to customize the response to include additional attributes
Create custom REST APIs in Hotel and Hotel Proxy applications
  • Possible to have custom request and responses
  • More development effort to build REST APIs
  • Maintenance effort is more, to make the changes in both the applications

3 Recommend the best design option

After careful study of the current business scenario, it is recommended to use the Pega Platform OOTB REST API call as it does not require lot of development effort and need to customize the response.

4 Identify required configuration tasks

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

  1. Create a REST connector for the interface between the Hotel and Hotel Proxy applications.
  2. Configure the REST connector with request and response.
  3. Create the CreateProxyCase activity in the Hotel application to invoke the REST service, which creates the case in the Hotel Proxy application.
  4. Create the ConfirmRooms activity in the Hotel Proxy application to invoke the REST service which updates the Rooms Request case of the Hotel application with the confirmed rooms.

5 Review solution details

The solution is implemented in the following rulesets:

  • RoomsRequestCase
  • RoomRequestInt
  • HotelShared_20221117T044535712
  • HotelProxy

Create a proxy flow in the Hotel application to invoke the REST Connector.

Rooms Request flow
Create proxy case

Confirm the Rooms flow in the Hotel Proxy application to invoke the REST Connector.

Hotel Proxy flow

Review the savable data pages generates to create a case, update a case

Create Case Savable data page

 Get case data page

Get case data page

Update case

Update case savable data page

Application settings

Application settings

Configuration sets 

Configuration sets

Hotel proxy application is invoking the savable data page from post action 

Post action savable data pages

 



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