on 2019 Oct 01 12:04 PM
Hello Mates,
I have a scenario wherein the body parameters is send from Sender REST pooling and same needs to be passed as HTTP Body Parameters at a REST receiver end.
POST /api/authentication/access_token HTTP/1.1
Host: HOst-sbx.npr.sandbox.com:443
Headers:
appkey: 11UVugFfQ12hTh5mGBfPckUssLrUdIig
Content-Type: application/x-www-form-urlencoded
Body:
client_id=RVqVK4APpp2hVWKn2fen96wsrqskb9k&client_secret=nilwkaR4&password=nil!&username=user@com&grant_type=password&auth_chain=OAuthLDAPService
Please revert on this. I'm getting below error.
Error while sending message to module processor: Sender Channel 'CC_REST_AccessToken_Sender' (ID: nilb7f8af3c7aa5481): Catching exception calling messaging system: com.sap.aii.adapter.rest.ejb.common.exception.HttpCallException: HTTP POST call to https://HOst-sbx.npr.sandbox.com:443/api/authentication/access_token not successful. : HTTP POST call to https://HOst-sbx.npr.sandbox.com:443/api/authentication/access_token not successful.
Thanks Much - Rajesh PS
Request clarification before answering.
Hello @rajeshps did you figure it out how to send body application/x-www-form-urlencoded content ?
I'm stucked with this because I need to sent my grant_type on body and it's not working for me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you got any solution to pass request body trought a REST receiver channel comunication? If so, can you teach me how I do it?
Tks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
rajeshps : shai18 : Did you guys got any solution on this. ARIBA OPEN API integration. Need some pointers as there were no help blog available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
rajeshps have you got any solution for this? I am using Ariba API for Procurement reporting for which I need to pass the filter parameter in the body.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajesh,
Try to use REST lookup.
I came across the same requirement earlier and I have use REST lookup for the same.
I wrote UDF by taking help of below blog post
https://blogs.sap.com/2015/09/11/yes-rest-lookup-is-possible-in-pi/
Regards,
Chetan Risbud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chetan Risbud ,
Above mentioned blog works if input is a xml and my question is unalike.
okay,
I am sure the ASMA properties are correctly populating from the udf 🙂
1. Please try without the parameter auth_chain
2. try with ---- ?grant_type={grant_type}&username={username}&password={password}&client_id={client_id}&client_secret={client_secret}
Also try to check if the receiver API requires any more parameters like resource, scope?
Regards,
Vikas Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below one is already tried which you can see above which is sent as dynamic URL parameters and it works.
But this isn't secured to send like below and there is no more parmeters.
?grant_type={grant_type}&username={username}&password={password}&client_id={client_id}&client_secret={client_secret}
Please suggest if any.
Hi Rajesh,
rather than passing the authentication parameters for oauth in URL as query , try passing as header in the header tab.
Regards,
Vikas Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks much for your reply vicky20691
API accepts Client authentication only in URL parameters or Body parameters.
It doesn't accepts in Header and hereby throws HTTP 400 Bad Request.
I wanted to have this a protected URL or send it as HTTP body with content Type: application/x-www-form-urlencoded to get a access and refresh tokens.
Hi Rajesh,
Please try with this topic.
https://answers.sap.com/questions/12648768/add-dynamic-http-headers-in-rest-adapter-but-first.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Piyawat Natpisarnwanit.
This is actually OAUTH 2.0 Authentication(grant type as password).
But why can't it accept as HTTP body parameters instead of Query. Since the details passed in query like client_secret, user, password etc. are clearly visible in PI logs nor XPI inspector. Is there any solution to overcome with a solution.
Hi Rajesh!
Why not to use XSL transformation or java mapping to produce text output (not XML), containing the needed string for body parameters? In HTTP receiver adapter you just set the headers.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm using REST adapter to post the data to receiver end. Below is the configurations:
But the thing is it is going as HTTP URL parameters, due to some security reasons I want to send as HTTP body only which is actually working in POSTMAN but failing in SAP PO..

| User | Count |
|---|---|
| 17 | |
| 8 | |
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.