cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while accessing SAP S/4HANA Cloud API using SDK or Rest OData

former_member823116
Discoverer
0 Kudos

I am trying to consume the SAP S/4HANA APIs from outside SAP (Postman or Java) I found a couple of options to access it

  1. Using Cloud SDK
  2. Using Rest OData endpoints

https://api.sap.com/package/SAPS4HANACloud

I observed that we can use the Cloud SDK only for the application which is deployed in SAP BTP Cloud foundry.

For Rest OData endpoints, couldn't figure out the settings for authentication for Production URL for SAP S/4HANA Cloud instance

Does anyone know if we can use the Cloud SDK or REST OData endpoints externally from local machine or from Postman?

Note: I am trying these things using a Trial account.

Accepted Solutions (0)

Answers (1)

Answers (1)

mkuhr-test
Advisor
Advisor
0 Kudos

You can use the SAP Cloud SDK for Java or JavaScript to connect to an OData service of S/4HANA Cloud. Both allow for local testing as well as for running on BTP (e.g. CloudFoundry).

I'd recommend reading through the documentation to better understand what the SAP Cloud SDK does. Also, here is a tutorial (Java) you can follow along to connect to an OData service. Consider starting with the sandbox environment of https://api.sap.com. For connecting an actual S/4HANA Cloud, the exact authentication setup depends somewhat on your system and your requirements.

former_member823116
Discoverer
0 Kudos

Hi @Matthias Kuhr,

Thank you for your reply.

I am still confused to understand about consuming the SAP Cloud SDK/OData endpoints in any third party or local system.

Do I need to deploy the app in the Cloud foundry of SAP BTP Cockpit only to get the SDK worked?

The intent is here to consume the SAP S/4 Hana APIs in a third-party environment. It will not be deployed on the SAP platform.

I mean, if I am working on a simple Java Console application, and wanted to connect with S/4 Hana Cloud instance and hit the API. So, is it possible to do so without deploying any app of SAP?
I believe the destinations can only be helpful if I deploy the app on the SAP instance. Correct?


That being said, simply I wanted to consume the Odata APIs from the isolated system/local machine/Postman. And I am interested to understand how to authenticate and call them.
If they support Basic auth, where would I configure the Basic auth username and pass in the system to access the services


Thanks,
Sunny

jschneider
Advisor
Advisor
0 Kudos

Hi Sunny,

did you already follow the tutorial Matthias linked? In there, it is explained how to run your SAP Cloud SDK based Java application locally - I think that should help you to understand what is technically required to run the Cloud SDK in any environment.

As you already figured, the SAP Cloud SDK uses the concept of "destinations" to establish a connection to external systems.
Such a destination is usually configured within the SAP Destination service, but you can also create a destination manually within your code.
This is also the place where you can configure your user credentials.
For more information, please refer to our documentation.