‎2021 Jun 09 1:36 PM
Hi Friends,
I am calling HTTPS Rest API (POST Method) by using CL_HTTP_CLIENT=>CREATE_BY_URL in SAP.
From Postman I am using POST method with sample URL "https://www.test.com/abc/xyz/pqr" and passing Basic Authentication credentials, and it is succesful.
If I look at the Postman HTTP code, it has two parts on the top:
POST /abc/xyz/pqr HTTP/1.1
Host: www.test.com
From SAP, if I use POST method and pass the full URL (https://www.test.com/abc/xyz/pqr) and pass basic authentication credentials, it gives Invalid Authentication (status code 500). If I just pass "https://www.test.com", it is successful.
I want to add the name of the POST method "/abc/xyz/pqr" before sending from SAP.
I tried by using option below code, I again get the error of Invalid Authentication. CL_HTTP_UTILITY=>SET_REQUEST_URI( REQUEST = LO_HTTP_CLIENT->REQUEST URI = '/abc/xyz/pqr' ).
Requesting your help in this, thanks in advance.
‎2021 Jun 09 4:44 PM
Hi Birendra,
Is the URI another SAP system or it is an external one?
If it is an SAP system, then you can use RZ11 to set is/HTTP/show_detailed_errors = TRUE and then obtain more details about the error.
If it is an external system, then you would need to know more about the external system API and see why an error 500 is defined as "Invalid Authentication" (in an SAP system it would be 401 Unauthorized).
Regards,
Cris
‎2021 Jun 09 4:51 PM
Hi Cris,
Thanks for your reply. It's an external one.
Thanks & Regards,
Birendra
‎2021 Jun 10 9:25 AM
Hi Friends,
Any suggestions, as this is working from Postman, and the same thing is not working from SAP.
Thanks in Advance.