Skip to main content

Creating the REST integration interface

5 Tasks

30 mins

Visible to: All users
Advanced Pega Platform 8.6 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
Hotel Contact [email protected] rules
Hotel Contact [email protected] 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:

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-RoomsRequest-Proxy" ,"processID":"pyStartCase" ,"content":{ "RoomsRequest":{ "FromDate":"20190331T130944.828 GMT" ,"HotelGUID":"d8825749-e2fb-46b3-97aa-3ead12b89584" ,"pxObjClass":"FSG-Data-Hotel-RoomsRequest" ,"pyLabel":" " ,"RequestSendDate":"20190325T130944.829 GMT" ,"ResponseDeadline":"20190329T130944.829 GMT" ,"RoomsRequested":"320" ,"ToDate":"20190402T130944.829 GMT" ,"Contact":{ "pxObjClass":"Data-Party" ,"pyEmail1":"[email protected]" ,"pyEmail1Type":"HTML" ,"pyFirstName":"Tony" ,"pyLabel":" " ,"pyLastName":"Parker" } } } }

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

{ "content":{ "RoomsRequest":{ "FromDate":"20190331T130944.828 GMT" ,"HotelGUID":"d8825749-e2fb-46b3-97aa-3ead12b89584" ,"pxObjClass":"FSG-Data-Hotel-RoomsRequest" ,"pyLabel":" " ,"RequestSendDate":"20190325T130944.829 GMT" ,"ResponseDeadline":"20190329T130944.829 GMT" ,"RoomsRequested":"320" ,"ToDate":"20190402T130944.829 GMT" ,"Contact":{ "pxObjClass":"Data-Party" ,"pyEmail1":"[email protected]" ,"pyEmail1Type":"HTML" ,"pyFirstName":"Tony" ,"pyLabel":" " ,"pyLastName":"Parker" } } } }

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.

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_20191202T192854184
  • RoomsRequestProxy
rooms-request-lifecycle

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

create-proxycase

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

confirm-rooms

 



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?

33% found this content useful

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