Skip to Content
0

How to fetch and use x-csrf-token in subsequent call in SAP PI.

Apr 25 at 05:40 AM

110

avatar image

Hi Experts,

we have requirement like REST----> PI ----->REST(POST) ,I have to pass the csrf-token in the header parameters of REST receiver channel (POST- method) as a dynamic value.

Can any one help me to fetch and use the csrf-token in SAP PI?

Thanks,

Raghava.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Muniyappan Marasamy Apr 25 at 08:38 AM
0

You want to send the csrf-token to receiver REST service in the header. This blog should help you.

https://blogs.sap.com/2015/04/14/pi-rest-adapter-define-custom-http-header-elements/


can you explain that what you mean subsequent calls here? i am not getthign this part. if your intention is to return the response header to sender REST dapter (client), then you can make use of "Specify Response HTTP Header" of sender REST adpter.

https://help.sap.com/viewer/5cf7d2de571a45cc81f91261668b7361/7.5.9/en-US/c80bd82a4a4c4408925110371b9a7643.html

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Muni,

Thank you for your quick response. I have referred already this link (

https://blogs.sap.com/2015/04/14/pi-rest-adapter-define-custom-http-header-element) for sending csrf-token as custom header value.

can you explain that what you mean subsequent calls here?

I have to fetch the csrf-token using REST API (GET) response header and use that csrf token in main interface receiver REST adapter (subsequent call).

My main intention is how to fetch csrf-token from response header of REST call and use it in same mapping to pass in main interface as dynamic header value.?

Thanks

Raghava

0

You may make this scenario as two interfaces, ask the sender to call first service to get the token and then after getting token, sender can call Main interface.

first interface to get token and second interface for sending main request.

https://blogs.sap.com/2015/09/11/yes-rest-lookup-is-possible-in-pi#comment-411889

or check this blog handling via adapter module

https://blogs.sap.com/2017/07/05/api-token-via-http-lookup-in-adapter-module/

0