cancel
Showing results for 
Search instead for 
Did you mean: 

Facing 401 unauthorized error while trying post data to CPI via SAP API Management

MadhuraJogi
Discoverer
0 Kudos
782

Hi,

I am trying to send request to SAP CPI via API Management.

But I am facing "401 Unauthorizederror while connecting to CPI though I have maintained correct credential in KeyValue Map. (CSRF token is unchecked in CPI HTTP adapter)

Using same credentials I am able to call CPI endpoint directly from Postman send data successfully.

I tried to test from both API Management and Postman(by calling API endpoint) but no luck. Also tried removing all the other policies.

Can someone help me understand if we have to do any kind of whitelisting or additional roles to be added to call CPI from APIM?

Below is the screen from APIM Debug :

MadhuraJogi_0-1725347310304.png

Thanks in advance.

Regards,

Madhura

 

View Entire Topic
Dinu
Active Contributor
0 Kudos

No. Nothing special is needed. The provided credentials are wrong or provided with the wrong header. 

The best way to connect to iflows from API Management is using API Provider of type Cloud Integration Flow. You start by configuring an API Provider of type Cloud Integration and then create an API Proxy with discovery using this. There is no need to configure any policies to connect to iFlows, if you do it this way. 

MadhuraJogi
Discoverer
0 Kudos

Hi,

I tried to create API Provider as well. First of all it is give 404 Not Found warning while doing the connectivity test.

MadhuraJogi_0-1725355897202.png

And if I try to create an API Proxy using that API Provider, it is not able to connect when I click on Discover option.

Regards,

Madhura

Dinu
Active Contributor
0 Kudos
You configuration is not correct. The response should be 200; Message OK. Use the hostname and credentials from the key for plan api from service SAP Process Integration Runtime. This provider is for discovery. When you configure the iflow later, you need to provide the credentials from the plan integration-flow. Warning: The iflow has to be of type API (REST or oData) for discovery to list these.