Skip to Content

SAP API Business Hub is the central catalog of all SAP and partner APIs for developers to build sample apps, extensions and open integrations with SAP.  In this blog, we would show case the discovery, explore and consumption of the S/4 HANA Cloud APIs to build a Fiori Application.

Discover and Explore APIs in SAP API Business Hub

SAP applications, platforms, and business networks continue to open up through APIs – to facilitate ecosystem-driven innovations and seamless integration – through the SAP API Business Hub.

  • To Discover, Explore and find the right APIs for your business use case navigate to https.api.sap.com
  • Click on the APIs tile to discover APIs from SAP SuccessFactors, SAP S/4 HANA Cloud, Concur, SAP Leonardo Machine Learning, SAP Leonardo IoT and 300+ more APIs.

  • In the Highlights region, all Featured APIs from the SAP API Business Hub team & the latest published APIs are shown.

  • Click on the All tab to view all SAP APIs from SAP SuccessFactors, SAP Hybris Cloud for Customer, Concur, SAP Fieldglass,SAP Leonardo Machine Learning, SAP Leonardo IoT and select SAP Partners.

  • In this blog, we are focusing on the APIs from SAP S/4 HANA Cloud and therefore click on the SAP S/4 HANA Cloud featured tile to view all the APIs from SAP S/4 HANA Cloud.

  • Any upcoming notification from SAP S/4 HANA Cloud is shown in the Overview page.

 

  • Additional documentation on integration with SAP S/4 HANA Cloud APIs are available under DOCUMENTS tab. Any Feedback, comments can be shared via comments/rating on the RATINGS tab
  • To view all the APIs from SAP S/4 HANA Cloud, click on the ARTIFACTS tab.

 

  • S/4 HANA Cloud contains a mix of OData and SOAP APIs. OData APIs are useful in building digital application like the Fiori application or the mobile application. SOAP service are useful in system to system integration scenarios.
  • Filter Artifacts allows user to search/filter any API within SAP S/4 HANA Cloud package. For example, to search for all the SOAP APIs for your integrations type in SOAP in the Filter Artifacts text field.

 

  • In order to search for specific API like Read Planned Orders, type in Read Planned Orders in the Filter Artifacts text field.  Click on the Read Planned Orders API from the filtered response to view the API Details.

 

  • In the OVERVIEW tab, API business documentation link, Best Practices explorer link and API’s sandbox, production endpoints details are provided.

 

 

  • Before proceeding further, we can log on to the SAP API Business hub, so that we can test these APIs live from the API Sandbox.

 

  • To view Business use case of the API click on the link “Scope Items – Material Requirements Planning (J44)”. Each of the S/4 HANA Cloud APIs is linked to Best Practices Explorer via the Scope Items which provides more business contextual information about the APIs.

 

 

  • This launches the Best Practices Explorer which explains the scenario in which the API can be used. Click on the Test Script to view more details about the required configurations, role assignments. Click on the Process Flow to view the process flow in the Graphical manner where this API can be used.

 

 

 

  • API Details like input parameters that can be passed, response that can be expected, example data set are documented in the RESOURCE tab. To view all this information, navigate to the RESOURCE tab.

  • SAP API Business Hub uses Open API Specification (a.k.a Swagger) viewer which enables Application developer to view API details in a developer friendly format. To view the details of the Planned Order entity and all the association operations, click on /A_PlannedOrder.

 

  • The Model view shows the details information about the Response field like property names, property data types, Property descriptions.

 

  • By scrolling down a little, you can see all the input parameters that can be optionally passed while invoking the API. For SAP S/4 HANA Cloud API, these input parameters are $top, $skip, $select, $filter, $count in case of GET or Read operations which are the standard OData system query parameters. For example, to view only 2 planned orders set the value of $top to 2. $top & $skip is very useful while building responsive user interface with client side pagination.
  • For SAP S/4 HANA Cloud APIs API Sandbox is available which allows the Application developer to test these APIs by just clicking on the Try it Out .

 

 

Testing from Postman and other API test tools

  • Postman is one of the API test tool which is used by the application developers. The S/4 HANA Cloud APIs via API Sandbox can be tested from Postman or other such API test.
  • Copy the request URL from the try out and this URL can be used for testing SAP S/4 HANA Cloud API Sandbox endpoint from Postman.

 

  • All the APIs from SAP API Business Hub API Sandbox are protected using API Key. This API Key would have to passed while invoking the SAP S/4 HANA Cloud APIs via API Sandbox in Postman. The same API Key can be used for testing any of the API Sandbox APIs.
  • To get your own API Key click on the Get API Key in SAP API Business Hub.

 

  • Click on the Copy API Key to use it from the API Sandbox. Take some time to read through Disclaimer about the API key usage (*Disclaimer: The SAP API Business Hub provides an API Sandbox to try out APIs. The API Sandbox is intended solely for evaluation purposes and should not be relied on for any productive use. Please refer to official SAP documentation and developer websites for package and API information for SAP packages. SAP does not represent or warrant that the information provided on this website is current, complete or error-free, or that this website will continue to be made available.)

 

  • The copied API key would have to be passed in the header named apikey. For this navigate to the Headers tab in PostMan. In the key column type in apikey and then paste in your API Sandbox API key into the value column.

 

  • Click on the Send button to view the response from SAP S/4 HANA Cloud API Sandbox.

 

  • SAP S/4 HANA Cloud OData APIs supports response in both XML and JSON format. In order to view the response in the JSON format, set Accept header to application/json and then click on the Send button.

 

 

Generate Code for Interacting with SAP S/4 HANA Cloud APIs

 

  • Generate Code functionality allows application developer to get sample code snippet in a programming language of their choice which enables them to interact with API in their application code project. For this, Generate Code option has been has been provided to each of the API entity/resource operation.

 

  • Click on the Copy to Clipboard to copy and use this generated boiler plate code in your code project.

 

Now that the right SAP S/4 HANA Cloud API has been Discovered and Explored in SAP API Business Hub,  we can consume this API in a digital application.  The consumption of the Read Planned Order API to Fiori application using SAP Web IDE has been covered in the Part 2 of this blog series.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply