PI REST Adapter – Blog Overview
Do you look for a way of integrating your SAP PI landscape with other REST services or to publish a REST service yourself using an SAP PI Endpoint?
If yes, then this blog could be of interest for you.
Do you have already had a look at the SAP PI REST Adapter and its configuration and now you feel “a bit overwhelmed” by the amount of settings?
If yes, then this blog is also the right one for you.
We have prepared a collection of blog entries for the REST Adapter that shows architectural concepts and configuration of the SAP PI REST Adapter and explain the internal processing steps. We also added some sample scenarios to make it easier for you to understand how your scenario can be implemented using the PI REST Adapter.
Let’s get started.
The first Blog in this series is about the REST Adapter concept and its configuration capabilities. It is a good ramp-up start for working with the REST adapter. It is called
PI Rest Adapter – Don’t be afraid
The next blog in the series deals with a simple scenario that shows how to consume a synchronous RESTful service. In the example, the target URL is set dynamically by using variables.
REST Adapter – Consuming synchronous RESTful service
A useful scenario is the next one that shows how to call a SAP function module via PI’s RFC adapter, and expose the same as a RESTful service.
PI REST Adapter – Exposing a function module as RESTful service
If you like to know more about JSON conversion within the REST adapter, take a look here:
PI REST Adapter – JSON to XML conversion
In case of the provisioning of RESTful services using a REST sender adapter, you have full flexibility for defining the endpoint of the service. An example of a dynamic endpoint can be seen here:
PI REST Adapter – Defining a dynamic endpoint
Within the REST adapter we have shipped a set of pre-defined adapter specific atributes that can be used to control the message flow. Furthermore, you have the possibility to define own custom attributes. An example is shown here:
PI REST Adapter – Using dynamic attributes
A new concept in PI which is unique to the REST adapter is that you are able to expose one and the same endpoint for addressing multiple Integration Flows. Besides the dynamic endpoint definition explained above, this gives you one more option in the definition of endpoints and your routing rules.
PI REST Adapter – Same endpoint for multiple Integration Flows
How the full set of CRUD operations can be mapped to the operations of a Service Interface in SAP PI is shown in the following examples.
In previous releases, we were limited to one Quality of Service per channel. So, in PI REST Adapter – Map CRUD operations to Service Interface Operations we stick to the POST, PUT, and DELETE operations which are all of asynchronous mode, and omitting the GET operation which is of synchronous mode.
With 7.31 SP16 / 7.4 SP11, we have introduced a new feature that allows you to dynamically set the Quality of Service either by HTTP operation or interface operation. This way, we are able to expose all operations as a single end point. An enhancement of the scenario is described in PI REST Adapter – Map CRUD operations to Service Interface Operations with dynamic setting of Quality of Service
If you like to learn more about the various options that the REST adapter supports for handling error situations, check out the following blog.
PI REST Adapter – Custom error handling
Some RESTful services require specific http headers. The following blog shows you along a use case how you can add custom http header elements to the receiver REST adapter.
PI REST Adapter – Define custom http header elements
If you like to poll REST APIs, check out this example: PI REST Adapter – Polling a REST API.
Learn how to access Concur travel and expense management solutions via its REST API, particularly focusing on the OAuth authorization at PI REST Adapter – Connect to Concur.
Still not found what you were looking for?
No problem! Just let us know what kind of information is missing and how we can help.
Excellent resource base for the topic. Kudos team!
Excelent documents, specially the first one - don't be afraid!
Looking forward to try this... (please SAP, update the AWS trial image to SP14!)
Thank you Ivo, for putting all information/links in one blog
Hi Ivo! Great info here! Thanks!
We just upgrade our PI to SP14 but no lucky to have the REST adapter available.
SLD still show SP12 (java stack) and SP14 (abap stack). Any light in here?
Cheers,
Angelo
Hi Angelo,
For me this looks like a deployment issue. From the distance I cannot really explain why the SLD still shows SP12 for the Java Stack.
Another possible reason for not seeing the REST Adapter is missing adapter metadata in ESR. Most likely, you have missed to update the adapter metadata in ESR. Open the ESR, and upload the latest software component version SAP BASIS 7.31/7.4.
See also upgrade and update documentation, chapter 3.5.1.
https://service.sap.com/~sapidb/011000358700000422062013E
Hope that helps (at least a bit),
ivo
Thanks Ivo.
Quick question, is there any way to suppress the Authentication when accessing the service?
Cheers,
Angelo
Hi Angelo,
The adapter runs under the security settings of NetWeaver and so you cannot change authentication security level in the adapter itself.
ivo
Excellent Blog.. Time to explore more about REST Adapter.
Awesome blog . One place for everything related to REST .. Bookmark it
Nice Share..
Thank you very much for the efforts in putting all the information together..
Nice share on PI Rest Adapter..!!
Excellent Blog..
Hello Ivo,
Great overview! Thank you for that.
There is one question I still have. Is the adapter also downported? If so, which PI version is the last supported for the REST adapter?
Best regards,
Fons
Hi Fons,
no, we don't have plans to downport the adapter. So you would need at least 7.31 SP14 or 7.4 SP9
Alex
Hello Ivo,
I have another question about the difference between REST and OData adapter. Can I use the REST adapter to forward Gateway OData services? Is this possible with the OData adapter? As there is only a Receiver adapter for the OData adapter.
Can you tell me the difference between the adapters? As OData is also using the REST protocol?
Best regards,
Fons
Hello Fons,
I have not worked with the OData Adapter yet, so I cannot say whether your scenario is feasible.
Regards,
ivo
No, you cannot. The simple difference is that the endpoint for rest or odata is different.
Hi Fons
Exactly my question too!
Having just come off a SuccessFactors implementation where we used the SFSF adapter (both the OData & SOAP flavours); I was confused between the standalone OData and REST adapters myself.
Any ideas Gents?
Finny Babu
Alexander Bundschuh
Shabarish Vijayakumar
Shabarish Vijayakumar
Sascha Wenninger
Regards
Arijit
great effort.
Thank you for collating lot of information on rest as one stop shop for REST.
With Regards,
SriPhaniKrishna
Hi Ivo,
Nice blog. We have a requirement for sending attachments using json/rest, is that possible?
The request content type should be multipart/form-data. The first part should be of mime type (contenttype) application/json and be named data and the second part should be of content-type application/pdf and be named mainDocument.
best regards,
Edwin
Hello Edwin,
mime attachements are not supported as of now.
Regards,
ivo
Is this feature already available?
Thanks,
/cd
Hi Ivo ,
Is this feature is added in SAP PO7.5?If yes please guide me how to resolve below requirment:
Scenario:REST->>PROXY :The request content type should be multipart. The first part should be of mime type (contenttype) application/json and be named data and the second part should be of content-type application/pdf as attachment.
Thank-you
Deepa
Hi Deepa,
Did you try above requirement, is it working for you.
I have similar requirement.
Thanks,
Varun
HI Thanks a lot for your blog!
I have a question for you and everybody else too!
Currently, without this Rest Adapter there is also a solution for RESTFUL communication using SOAP Axis Framework.
Let us assume, if the PI/PO system (SP14) is installed without this SOAP Axis Framework, will the REST adapter still work ? or there is a dependency that the SOAP Axis Framework should be installed first ? In other words, Is this New REST adapter dependant on the SOAP Axis Framework or independant ?
Regards,
Vk
Hi Vk,
the REST Adapter does not use SOAP Axis.
Regards,
ivo
Hi Ivo,
Thanks for sharing excellent blog series !!
Any idea if we can send HTTP 202 instead of HTTP 200 from PI REST Sender Adapter , like we have a similar functionality for SOAP adapter.
Regards,
Vishal
Hi Ivo / Alexander,
Thanks for this excellent series of blogs on the REST adapter.
We had a requirement for sending specific json objects as arrays even if there was only one value in it. The reason for this is that the 3rd party provider has used a REST design where to keep consistency, they have serialized some objects as arrays only. This causes the server to look for an array for that json object. When we trigger from SAP PI with 2-5 values for that object, SAP PI converts this object into an array and adds the square brackets with the curly brackets to it. When we trigger from SAP PPI with only one value for that object, SAP PI assumes this object to be a single value and hence does not convert it into an array and only sends curly brackets.
Is there a way to indicate to SAP PI REST adapter that a particular object should always be treated as an array and force it to send square and curly brackets even if there is only one value for the object.
Hi Vipin,
this is not supported right now, however we have it on our backlog, most likely by Q3 2015, but no promises
Alex
Thanks Alex. Looking forward to it.
Do you know of any tweaks/workarounds that are available to meet this requirement?
sorry, no
Alex
Hi Alex,
Is the functionality for indicating that an object should always be treated as an array included in the latest SP13 of PI 7.4. This was for forcing PI REST adapter to send square and curly brackets for an object even if there is only one value for the object.
I tried to access the note for the SP 13 which is mentioned in the PAM (2240919), but it gives me a not released message.
Hi Vipin,
yes, this is supported, see collective release note https://css.wdf.sap.corp/sap/support/notes/2215626
Alex
Thanks a lot for the response, Alex.
We will install this SP and test this out.
Regards,
Vipin
Hello Alexander, if I could not install the latest SP what is the note that fixes the problem related to "send square and curly brackets for an object even if there is only one value for the object"? I cannot see in the collective note nothing directly related to this issue.
Thanks
Enrico
Hi Enrico,
it's actually SAP note 2175218 referenced in the collective note
feature only comes with the SP
Alex
Can we remove square braces and keep only curly braces for JSON object?
{
“Record”: [
{
“Item”: [
{
“Field1”:
“Field2”:
}
]
}
]
}
From the above one can the square braces for Item can be removed?
Thanks,
LM
I see there are many articles debating SAP PO vs Gateway.
With so many features for SAP PO REST Adapter, why not use SAP PO over Gateway for enabling REST based services
Some thoughts on that in the comment section of this blog - Integration && Orchestration 2014 - A Report Card from Berlin
Hi Siva,
I would like to refer to the following blog and especially the comments
http://scn.sap.com/community/process-orchestration/blog/2014/11/26/exposing-gateway-services-from-process-orchestration
Alex
Thanks for the post VERY usefull.
One issue I have,
In the REST URL I need to construct a URL pattern that have more than 10 variables.
When I use the "pattern variable replacement" I have only 10 entries...
How can I add more variables...?
Thanks
Regards
Martin
Thanks for the post!!!
I have this scenario, the same restful services has two operation. One for the authentication y the another one for get information (dont work the second operation if you didnt call the first operation).
The authentication operation send back a cookie and with that cookie is possible call the second operation and get the information.
I know that scenario is possible develop with SOAP Receiver, AXIS Transport Protocol, but this option I didnt find in the communication channel options.
Do you know if this scenario is possible with REST Adapter?
Thanks for your help.
Hi Victor, I have this same scenario and I am wondering if you were able to resolve it?
Thanks,
Katie
Excellent Blog.
Thanks for share!
Hello Alexander,
is it possible to set header parameters (in response messages) like "Access-Control-Allow-Origin" in REST-Sender-Adapter to provide CORS mechanism for Webservices ?
Thank you in advance.
Best regards,
Fabian Engel
Hi Fabian,
CORS is supported anyway since 7.31 SP17, see https://css.wdf.sap.corp/sap/support/notes/2175269
Alex
Thanks Alexander! Seems SAP closes functionality gaps really quick! 🙂
According to OSS Note for our case this functionality should be delivered with XI ADAPTER FRAMEWORK 7.40
SP013
000000
Nevertheless in SAP Software Download center the latest patch for SAP_XIAF component is from 2015/11/06 SP12 for XI ADAPTER FRAMEWORK 7.40
yes, sorry I forgot to mention the 7.4 release, so it's actually supported in both 7.31 SP17 and 7.4 SP13
Alex
I think there is a missing link source in OSS Note.
Trying to click on the download link for 7.4 SP13 gives below result.
As well I can't find the SP for SAP_XIAF Component in Download center.
No deliverable object available due to objects not available for download yet or insufficient authorization of logged on user
Can you confirm?
Thank you
Hello,
thank you for this complete blog ! Good job !
I have a question about standardFaultMessage of a Synchronous Service Interface during execution of WS in REST mode. How it works
? How the fault message is filled ?
Thank you, have a good day.
Regards
Hi Sylvain,
check out the custom error blog at PI REST Adapter - Custom error handling
Furthermore, with 7.31 SP17 and 7.4 SP13 we have enhanced this feature, see SAP note https://css.wdf.sap.corp/sap/support/notes/2175250
The fault message needs to be filled in a mapping
Alex
Thank you, I will check that.
Regards
Hi Ivo / Alexander,
Is NTLM authentication possible?
I have posted my requirement @ Sharepoint Integration with REST adapter + NTLM authentication
Thanks,
Praveen Gujjeti
Hi Praveen,
this is not supported yet
Alex
Thanks Alex for the update. Any idea if this is planned in upcoming support packs?
Best Regards,
Praveen Gujjeti
Hi Alex,
can you please help me with my last question: "Any idea if this is planned in upcoming support packs?"
This will become an important decision by my client to choose SAP PO or some other middleware solution based on NTLMV2 availability in REST adapter
Thanks in Advance,
Praveen Gujjeti
Hi Alex,
In one of the comments above it was mentioned that the PI REST adapter did not support MIME attachments for now. Is there a plan to support this in the near future?
We have a requirement to send an XML file as an application/octet-stream attachment to a RESTful PUT service.
Regards,
Vipin
Hello,
First, congratulation for your blog, it has helped me a lot !
Second, my question : do there is a way to customize timeout as for SOAP adapter with parameters XI.Timeout / XMBWS.Timeout
Thank you
Regards
as far as I know this is not supported yet
Alex
Ok, thank you for your answer
Regards
Hello,
we have a SOAP<sync>REST scenario, I need to catch the response to send it back to the sender.
What I experiment is to handle "http code" with value "400". When the flow start there is no error (status seems to be catched) but I can't see the "Message Content" from Action "Custom Result" even in Logviewer.
What I want to do is to get back the "Message Content" and integrates it into the response part of my service interface sender. I m not sure it is possible with my version, If I have well understand it only possible from the version 7.4 SP13, is that true ?
If my version is efficient to catch the "Message Content" I have not understand how to do (sorry If you already explain it)
Our system : SAP PO 7.4 SP11
Thank you for your help
Regards
beautiful blog
Hi Alexander,
REST is the adapter I was expecting from SAP AG since quite some time - robust and really feature-rich. Well done to you and your team !
What I can feel, as well, is that due to its mightiness, this adapter will be (mis)used in slightly different cases than pure REST (if there is such thing as "pure" REST) - have seen already usecases for it - JSON parsing instead custom adapter module, URL vs. payload manipulations, etc. .... I can see it now as a superset of the other adapters, hopefully, we will not end up in complete RESTfulness in AAE/CC configurations
...
Cheers,
Lalo Ivanov
Great blog thanks.
Hi Alexander
A good blog for starters on Rest Adapter. Thank you for that.
We are facing an issue with CORS, thought if you can help us here
We used the PI Rest Adapter and created a service. We would like to use this service for mobile applications, hence the browsers are throwing the below error
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.
I have added the Allow Public Access in Channel section of the Sender Adapter and tried with Allow Cross site requests values - Allow all clients and also Allow Specific clients.
Still i donot see the response header being added and the same error is being thrown.
Please let me know if there are any other configurations that have to be done
We are on PI 7.4 SP13 for the component SAP_XIAF and others we are on PI 7.4 SP10
Thanks
Kiran
I think there is a broken link: PI REST Adapter – Exposing a function module as RESTful service
It's working now - thanks!
FYI - SAP just released a note which enables the REST sender to use any of the logon modules available in NWA and also to customize a logon chain as well as applying login policies:
2380856 - Unable to invoke custom logon module on PI REST sender channel
Theoretically this should enable Kerberos SSO and others.
Any one having issue with DELETE operation in REST Receiver channel?
I raised a message in SDN forum. If any faced similar issue and resolved it, please send me the details.
https://answers.sap.com/questions/78068/issue-with-delete-operation-in-rest-adapter.html
Hi Alex,
Is there any plan in future to come up other OAuth 2.0 flows for rest adapter to connect with SalesForce and MS Dynamic CRM? PI rest adapter does not provide great flexibility connecting to 3rd party cloud based tools having different authentications and grant types.
Right now only two kind of authorization flows is being supported by PI rest adapter i.e. SAML and Concur.
Could you please help me to resolve following issue. I tried lot and couldn't resolve it.
https://answers.sap.com/questions/182891/rest-service-using-get-method.html
Hi all,
It seem that the REST (sender) adapter is not handling gzip transport compression, even when the http header Content-Encoding: gzip is set.
This is wrong in my opinion. For example the HTTP adapter is able to handle it and automatically decompresses gzip compressed messages when it receives a call with the mentioned header set.
Has this not been implemented or are we doing something wrong?
I even tried to write an adapter module that decompresses the message, but it seems the adapter somehow corrupts the binary data it receives, so that decompression fails (of course we unchecked “Convert to XML” so that the adapter should not try to convert the compressed string – we would do that in the custom module later).
Thanks,
Philippe
Hi All,
Has anybody used Receiver REST adapter with JSON and POST operation. Please look into below error and share your thoughts.
https://answers.sap.com/questions/289228/rest-receiver-adapter-throws-error-with-json-forma.html
I am using SAP_XIAF version 7.40 SP 12.
While Integrating SAP PI landscape with other REST services, what makes difference between standalone OData and REST adapters??
Hi Team,
I have a query, is it possible to hit PI REST sender adapter from POSTMAN using form-data.
If yes, how ?
I got some blog from SAP but, no didn't understand.
Please read this note:
2365727
--> "With this SAP Note since 7.50 SP07 a new functionality is added to the REST adapter that allows sending and receiving MIME multipart messages "
I guess the form-data what you select in POSTMAN is also such a multipart message, at least according to this document:
https://en.wikipedia.org/wiki/MIME
Kindly assist with the steps.
Thank you.
Raghavender, SAP PI Consultant
Hi Ivo and Alexander,
Can you provide me information whether the following features are supported in the REST adapter:
Thanks in advance!
Kind regards,
Mark van Dooren
For the German speaking colleagues:
In case you are interested in a REST adpater specific training, itelligence is now offering a 2-day workshop going through REST in general, the REST adapter and REST scenarios.
You can find more information here:
https://itelligencegroup.com/de/training-de/seminars-in-house-training/more-info/?id=50049918
Might also be possible to have this training in English on request.
Hi ,
Need help form you. My scenario is SAP PO 7.5 to Sales-force using REST adapter with oauth2.0.
I am able to send data from SAP PO 7.5 to Sales-force using REST adapter with oauth2.0 including PATCH method.
But how can i do Bulk API transmission using REST adapter?. Please guide me to achieve Bulk API data transmission.
Thanks in advance for your help.
Best Regards,
Karunakar A
Hello
Need help form you.
I want to increase Rest Receiver synctimeout in Sender (SOAP) To Receiver (REST) Sync scenario .
I faced error at 'Synchronous timeout exceeded'.
So, I set 'syncTimeout=10Min' in 'SOAP' Sender.
But, 'Call Server' in Rest Reciever adater and getted timeout error within 5Min.
Could you tell me how to increase Rest Receiver timeout?
Thanks in advance for your help.
Best Regards
Hi,
Thanks for the wonderful blog. Is there a way to consume REST services from SAP Hybris?
Hi Expert,
I am REST adapter synchronous scenario I am getting csv format response from the target system.
Please guide me how I can receive csv format data in synchronous call using REST adapter.
Thanks in Advance for your help.
Hi expert Ivo Kulms
I read some of your post about rest adapter sender(I see that you have experience) and I wanted to ask you if you can look at the answers in this post , which I wrote … I am new to pi and I don’t know how to do this. I tried several things but without success …
https://answers.sap.com/answers/12903884/view.html
Thank you very much, regards.
Hi Expert,
Do we have any option to retrieve the Source IP address of who is calling our Sender REST adapter?
Regards
Baskaran K
2435422 – New Feature: Binary data handling from REST Adapter https://launchpad.support.sap.com/#/notes/2435422
In Binary mode – if the Content-Type header for the sender “result http header” must be set then make sure to use camel case. The header is case sensitive. It will be returned to the consumer in lower case.
Hi,
I am working on REST synchronous scenario, we're the REST API will be called based on HTTP operation (POST, PUT, DELETE) ,very strange behavior what I observed is, whenever there is a change in the HTTP opearation the channel fails to identify the operation and the message gets triggered for the previous operation but, if I edit and activate the channel it identifies the operation that is selected.
Kindly assist me on this
Thanks in advance
Any information about handling API authentication when exposing a REST service?