Skip to Content
Author's profile photo Former Member

Rest Sender Adatper Poll (REST API—>PI—>JDBC)

Dear All,

I have little struggled on REST adapter when fetching the data from rest web service using SAP standard REST adapter. But I have achieved on this requirement with the help from SAP document , Alexander’s Blog & SAP thread

PI REST Adapter – Polling a REST API

Restful webservice-source

Prerequisites on this REST sender poll:

PI 7.31 SP 16 (or) PO 7.4 SP11

SAP XI AF java component should be the latest patch level 1( Available up to today) and please make sure all dependent components should be update when you update SAP XI AF.

As you know from PI 7.31 SP 14 (or) PO 7.4 SP 11, SAP has introduced standard REST features. and they keep on adding the features. the latest one is available on  PI 7.31 SP 16(or) PO 7.4 SP 11 and it contains Rest Sender Adapter poll.

This feature is exactly match with my requirement(REST API–>PI–>JDBC) when PI wants to use GET operation (for fetching data from Rest API)

My REST API gives JSON format, so PI must converts into XML format for understand, mapping, routing.. etc. So I used REST sender poll adapter which is avialable  on PI 7.31 SP 16 (or) PO 7.4 SP 11.

My sample JSON Format



My JSON structure is very big , but I short you for very few fields with values. see in my JSON , “projects” is root tag of JSON and there are two datasets.

According to JSON format, I have created the datatype, message type in ESR( the data type structure is very important, you need to create right way according to your JSON structure)

RestAPIDatatypeon ESR.jgp.jpg

see in the screen shot ‘projects’ should be 0 … unbounded , because we have multiple datasets on JSON.

Importantant Note: I heard from some blogs multiple data sets not possible to convert JSON to XML ,but on PI 7.31 SP 16 (or) PO 7.4 SP 11 is possible to convert multiple data sets, so we do not need any customer adapter modules

See I only added screen shot of Datatype which created on PI ESR. I do not cover any data type structure of JDBC, message type, Message interfaces, mapping… etc. You can create as usual according normal integration scenario.

Integration Directory settings

This is my sample REST Web service URL:  https://tools-dev:9007/ceres/data/basic?lastChangedTime=2015-06-01T01:00:00Z

But i have to generate dynamic value on URL when PI calls the Rest web service  using GET operation. so we need to set up our connection according to that.

Sender Adapter poll:

See in the REST sender adapter , we can able choose REST (or) REST Pooling in the message protocol, selected REST polling according my requirement


Now in the ‘General’ tab. i used only basis authentication. Note: but make sure if your web sevice requires certificate based login then use client certificate authentication check box. in my case I just imported REST web service certificate into PI NWA but I didn’t used the client certificate authentication section . in my case I get  error without certificate import.

Quality of Service: Exactly once  (because i used asynchronous)



In the HTTP Request tab, specify your HTTP/HTTPS url for call Rest API webservice and choose REST operation and Polling Interval.

See in the URL I used “{incrementalToken}” for generation of Dynamic value using Incremental Requests

(Setting up Incremental RequestsFor REST APIs that allow incremental requests, the adapter allows to store the timestamp of the latest call or a custom value (specified by an XPath expression or a JSON element). The value will be stored between the calls and can be referenced in the REST URL as a placeholder with name incrementalToken)

HTTP operation : GET

Polling Interval time : accroding to your freequency of Data


In the ‘ Data Format ‘ Tab choose data type format that PI receives from Rest

Check the box that “convert JSON to XML

ADD Wrapper element section : Put your message type which has created in ESR and Namesapce of message type


In the same tab “Data format” there are  few more other options to use. but in my case I used only “incremental Requests” for generate the dynamic value on REST URL when PI calls the REST web service for fetch data(GET)

See in the incremental Requests section, I choose the incremental type is “Timestamp of Last call”

Time stamp format should be ISO 8601

initial value  for one time request( it should require)


I hope it will help you how to use Rest Sender poll adapter

In this blog I only pointed out how you can fetch the data  using sender REST poll adapter. I do not concentrating on Target side.

Thanks & Best Regards,

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Maheswarareddy Konda
      Maheswarareddy Konda

      Hi Sateesh,


      Thanks for sharing..


      I think you are referring 7.4 SP12, which will be released in november'15


      so please change SP11 instead SP12.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Mahesh,


      Thanks. You are right. I have counted wrongly.


      With Best Regards,

      Author's profile photo vikram anne
      vikram anne

      Hi Sateesh,


      I just want to add additional HTTP header for REST receiver adapter, i had heard that a new tab has been added in latest patch,but we didnot update our PO system,so is their any way by which i can achieve this?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Vikram,


      May be you can achieve this through UDF but not sure.


      Thanks & Regards,

      Author's profile photo Maheswarareddy Konda
      Maheswarareddy Konda

      Hi Vikram,


      Unfortunately there is no other option to use HTTP headers.


      but that feature is available from 7.41 SP10/7.31 SP15..u can upgrade PI Server.





      Author's profile photo Former Member
      Former Member

      Hi Sateesh,


      We have one requirement like ( REST<->PI<->Proxy) . I have created two data types for third party (Input and response) and two data types for sap systems and message types, message interfaces),My input message type Like





      response like



          Project  (0..1)

          Startdate (0..1)

          enddate  (0..1)

      we completed all the steps in ESR and also configured REST(sender) adapter and XI adapter in ID,


      Rest adapter details Like:

      General Tab:

      data format: JSON


      In Channel Selection tab:

      Endpoint:: Row/ProjectData/PROJECTID


      when we test below URL facing error:

      URL::  https://XXXXXX:50000/RESTAdapter/Row/PROJECTID/

      error is Java.Lang.NullPointer Exception.


      Could you please help on this.




      Author's profile photo Maheswarareddy Konda
      Maheswarareddy Konda



      Since you are getting Nullpointer exception,,,we will see config later..


      can u pls confirm, are you able to see any data in that log and if you able to see , wat type of data like xml or json?

      Author's profile photo Former Member
      Former Member

      Hi Maheswara,


      No data available.




      Author's profile photo Maheswarareddy Konda
      Maheswarareddy Konda

      ok, Then the problem with data, pls check with corresponding team

      Author's profile photo Former Member
      Former Member

      we are not sending any data through this Url,when we execute the this URL we need project information from SAP system as response.

      Author's profile photo Maheswarareddy Konda
      Maheswarareddy Konda

      Ok, Then this is not correct blog to you


      Pls read this PI REST Adapter – JSON to XML conversion

      Author's profile photo Former Member
      Former Member

      I had below queries on the REST Polling adapter :


      1. How do you view the runtime target HTTP URL, do you see in audit logs, I didn't find that. So if I use {IncrementalToken} with Last datetimestamp, I would like to see what value gets replaced in the token each time the interface runs. If the call errors out I can see the error URL but not when it is a success I can't see the URL


      2. In " Timestamp of last call " there is a field for Initial value, when does this get into effect. The first time we run this interface ? Say I am stopping this channel and again restarting it, then what time it takes for " Timestamp of last call " or does it take the initial value which I mention in configuration?


      3. There is an option of MessageSpilt - Split Result into Multiple Messages, here I can specify the xpath of the element or table which iterates. So how does this spilt happen, does it slit say I have 5000 records into batches of 50 or it is 5000 single record ?


      Thx in advance


      Author's profile photo Sunil Mavachee
      Sunil Mavachee

      Hi Ravijeet,

      We are working on similar scenario 'Sender REST with Polling' - Incremental token of timestamp.

      I believe you are able to trace the log of it "I was able to figure this out, I changed the polling logs to debug level and I was able to view the constructed polling http url"

      Appreciate if you could share the same please.

      Thanks and Regards,




      Author's profile photo Eric Hernandez
      Eric Hernandez


      Hi Sateesh,

      How can I manage the Incremental Content, when you have a Query in the URL?.


      Original URL: Id, Name,  from Product2&nextRecordsUrl={incrementalToken}


      Response 1:

      “nextRecordsUrl”: “/services/data/v43.0/query/01g2900000c6HnhAAE-2000”


      Expected Response 2:

      “nextRecordsUrl”: “/services/data/v43.0/query/01g2900000c6HnhAAE-4000”


      And so on.


      The next execution should be like:

      At the moment I have been unable to make it work. I’m doing tests with:

      Incremental Type: Response Content

      Incremental ID Element: nextRecordsUrl

      Action for Missing or Empty Token: Use Initial Value for Token

      Value: 0


      With this, the channel always retrieves information for the first batch as the ID of the "nextRecordsUrl" changes on each execution instead of being maintain.



      1st time is  "01g2900000c6HnhAAE-2000”

      2nd time is "01gK0000011AgxaIAC-2000” (the ID Changed)

      and so on...


      Please advice ?


      Thanks and Best Regards,



      Author's profile photo Eric Hernandez
      Eric Hernandez

      Hi All,


      I got it working for two consecutives executions, nevertheless, its always failing on the third one….


      The current settings are:

      Tab HTTP Request

      Target URL:{incrementalToken}


      Tab Data Format

      Incremental Type: Response Content

      Incremental ID element: nextRecordsUrl

      Action for Missing or Empty Token: Use Initial Value for Token

      Initial Value: /services/data/v43.0/query/?q=select Id, Name, ProductCode, from Product2


      With these configuration the results were the followings:

      1st Execution


      2nd Execution


      So far it is working propertly, but when getting to the last execution the JSON do not have the field "nextRecordsUrl"

      Last Execution

      “Fatal error while proccessing inbound JSON path “nextRecordsUrl” could not be found.

      Any suggestion regarding why is always failing during the third execution will be highly appreciated.


      Thanks and Best Regards,


      Author's profile photo SHIVETA PANDITA


      How do you take care of the Bearer Token part here? In my scenario (REST Polling Sender), its a must before making a GET call to Salesforce.