In this blog I am going to show you how to achieve RESTFullness with PI REST Adapter. Use this blog as a hands-on starting point to your RESTFull journey. I have followed the blog series at http://scn.sap.com/docs/DOC-60854 and it’s really full of information. With this blog I am going to share the example I prepared to practice REST Adapter, so as to give you head start.
I am going to use the rest service http://www.thomas-bayer.com/sqlrest. This service gives information about Customer, Invoice, Item & Product. The iFLOW’s that I created are REST to REST (just to keep it simple and show both sender and receiver configurations).
The REST call in my example can go up to three levels deep. So I created three different iFLOW’s representing three different entities.
Level 0 (IFLOW: Test_R2R): http://HOST:PORT/RESTAdapter/sqlrest/
Level 1 (IFLOW: Test_R2R_Level1): http://HOST:PORT/RESTAdapter/sqlrest/CUSTOMER/
Level 2 (IFLOW: Test_R2R_Level2): http://HOST:PORT/RESTAdapter/sqlrest/CUSTOMER/11/
Please import the attached iFLOW’s to run the scenario in your PO SP8 and above.
Some important REST adapter configurations
Sender REST Endpoint is same for all three iFOWS:
Since Level 0 is the default so use “/” in the URL Pattern in the sender REST.
Level 0 Receiver Rest is to be configured as follows
Level 1 represent Customer or Item or Product therefore in this configuration we use patters to capture the details of the Level 1 as “resource”. The Level 1 sender REST adapter need following configuration.
In the Level 1 receiver REST adapter the “resource” is read from the dynamic configuration and is used here to generate the right URL.
For the Level 2 sender REST adapter we now configure two parameters “resource” & “id”.
In the Level 2 receiver REST adapter the values of “resource” and “id” are read from the dynamic configuration to generate the right URL.