cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming ABAP Restful API without having to take care of Session Cookies

BenjaminWeishei
Participant
0 Kudos

Hello Experts,

we published an ABAP Restful API (Release 19/09, unmanaged implementation, OData V2), which is consumed by an Azure Function.

In our architecture CSRF protection is not required and we would like to miminize the number of API calls. So we deactivated CSRF protection by setting the Gui configuration parameters in SICF and adding the X-Requested-With Header to our Post request. We thought this was enough to avoid having to send a GET request before each POST request.

Then we observed a funny behaviour: Post request that were send to the SAP system were converted into GET requests. The system changes the request_method header from POST to GET and processes it as GET request. The request was originally sent with a post method (we checked this several times)

It seems that this is related to the session cookies sent by the SAP system. Where these session cookies are fetched and included into the POST request, the this strange conversion doesn't happen. Sending a POST request without any session cookie causes it to be converted into a GET request.

So my questions are:

1. How can we expose an truly stateless ABAP Restfull API. Without CSRF protection AND without bothering our api consumers with any session coockies. A Post request should not require a predeceding GET request to fetch anything.

2. Could this be related to the selected Binding Type in the Service Binding (UI or Web API)? Is there a documentation that explained the impact of each setting in detail.

Thank you in advance and best regards,

Ben

View Entire Topic
Andre_Fischer
Product and Topic Expert
Product and Topic Expert

Maybe these 2 SAP Notes will help you to influence the response of the system depending on settings sent by your http client :

2760552 - Limitation of generation of HTTP security sessions - SAP ONE Support Launchpad

2754328 - Disable creation of HTTP Security Sessions per request - SAP ONE Support Launchpad

Kind regards,

Andre

BenjaminWeishei
Participant
0 Kudos

Hi Andre,

thanks for the quick reply. Unfortunatelly adding the x-sap-security-session Header and changing the security session fot the SICF node didn't solve it. Any other ideas?

Could this be related to the Binding Type?

Thanks,

Ben