AppGyver with S/4HANA Cloud APIs


I’m building an application to demonstrate to a customer which needs to retrieve information using an API from S/4HANA Cloud. And also Post. However, i’m receiving a CORS error when testing the API and also when previewing the application, no information is displayed giving specific error 400 (not authorized).

Not sure if should be done via API Proxy because i’m not using an AppGyver service from SAP BTP, meaning there is no direct connection to the system.

Anyone encountered such issues while connecting to S/4HANA Cloud APIs?

Thank you in advance
Tiago Ribeiro

Hi @Joao_Tiago_Ribeiro,

I’m not an expert on S/4 HANA, but a 400 error sounds like you might be missing some authorization in your request? Does the same request work if you make it from Postman? What’s the specific error message from the Chrome dev tools Network tab (right-click + Inspect → Network)?

Furthermore, I recommend checking out the SAP AppGyver topic page and the SAP Community in general about integrations between SAP systems and AppGyver, you might find something useful there: SAP Build Apps | SAP Community.

There’s also this thread on CORS issues with SAP APIs, maybe something worth checking:

1 Like

Hello Mari,

Thank you for the inputs given. I will take a look at both communities and check if anyone find a solution for it.

Responding to your question, i use the same credentials i have set in the respective API and if i try to use it via postman and via browser, both work after entering the credentials of the API.

Meaning, seems to be a specific situation in AppGyver, or being new i’m not yet familiarized with the process of configuring such API.

However, i’ve made some changes in the configuration of the data resource and now there is no error being sent when performing GET action, directly in the Preview app (as i’ve made the configuration to see the error in there). Although in the Test Data Resource, still i receive the CORS error message.

Thanks anyway
Tiago Ribeiro

My recommendation is that you do it using SAP API Management as a proxy service to your S/4HANA Cloud APIs. SAP APIM offers an out-of-the-box CORS policy where you can manage additional headers as well; I hope that helps; Piotr

Thank you Piotr.

Your support solved my problem. Indeed API Management will bypass these issues found and both APIs are now being used without any issues.

For the POST it requires a bit more patience and work in the API Management with additional proxies.