Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
divyamary
Contributor
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, exploration and consumption of the S/4 HANA Cloud APIs to build a Fiori Application.

SAP Cloud Platform Web IDE a powerful web-based integrated development tool that simplifies end-to-end application development enables developers to quickly discover APIs from SAP API Business Hub to generate Fiori applications.

In the blog Discover, Explore and Consume APIs from SAP API Business Hub, generation of a Fiori application using APIs available in SAP API Business Hub is captured. In this blog, deployment of the generated application in SAP Cloud Platform account would be showcased.

Build Fiori application consuming APIs published in SAP API Business Hub


All the APIs from SAP API Business Hub API Sandbox are protected using API Key.  During the preview of the generated application, SAP API Business Hub project settings takes care of setting the required API Key of the logged in user.  Before deploying the generated application on SAP Cloud Platform account, this api key would have to set explicitly in the generated code.

In this section, the changes required on generated Fiori applications to set the generated api key is shown.

  • Login to SAP API Business Hub to get your API sandbox key ( as described in part 1 of Discover, Explore and Consume SAP API Business Hub APIs blog series)




 

  • 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.)




 

  • Open SAP Cloud Platform Web IDE Full stack service.

  • Build a Fiori application named MyPlannedOrders as described in part 2 of Discover, Explore and Consume SAP API Business Hub APIs blog series.


 



 



 



 

 



 



 



 

  • Expand the generated MyPlannedOrders.



  • Click on manifest.json from the expanded project in WorkSpace explorer and change the mainService datasource to set a custom http header named apikey to the API sandbox api key


 "" : {
"dataSource": "mainService",
"preload": true,
"settings":{
"headers": {
"apikey": "YOUR_API_KEY_FOR_API_SANDBOX"
}
}
}

 




 

Deploy Fiori application to SAP Cloud Platform



  • Select the generated MyPlannedOrders Fiori application, click on the menu button Deploy. Select Deploy to SAP Cloud Platform option.




 

  • In the Deploy Application to SAP Cloud Platform dialog, provide an application name ( say myplannedorders)  and click Deploy.




 

 



 

  • This responds with HTTP status code 404 - Not Found.




 

 



 
4 Comments