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: 
Xavier
Product and Topic Expert
Product and Topic Expert









In this blog, you will find step-by-step instructions to consume an API from the SAP API Business Hub using an SAPUI5 Application created in the SAP Cloud Platform.

The goal of this blog, is to explain how to create a simple ALM analytics application accessing the metrics collected by SAP Solution Manager through the OData API of Focused Insights.

 

This ALM tutorial series is dedicated on creating value-added app extensions on top of SAP Solution Manager, Focused RUN and/or SAP Cloud ALM.

Thanks again for reading.


 

 

SAP API Business Hub



The API Business Hub provides APIs to build apps, extensions and integrations easily.


APIs are digital building blocks for modern apps and open integrations and SAP Business Hub provides a rich catalogue of APIs both from SAP and its partners.It contains an API sandbox which lets you easily try out an API before deciding whether to use it or not. It also makes it easy to consume APIs by providing generated code.


 

SAP Cloud Platform


SAP Cloud Platform is a platform for creating new business applications or extending existing ones in a secure cloud computing environment.


SAP Cloud Platform is SAP's innovative cloud development and deployment platform. It is supported by multiple cloud infrastructure providers and enables innovative technologies such as the Internet of Things, machine learning, artificial intelligence, and big data, thereby enabling you to achieve business agility and accelerate digital transformation across your business.


 

Focused Insights SAP Analytics Cloud API



We start the API Business Hub from https://api.sap.com/ and search for the Focused Insights for SAP Solution Manager SAP Analytics Cloud API.



















API Testing



We can try out the selected API to see what data it extracts and how it works.


In this case, we need to enter an OCC gadget ID number that corresponds to data from SAP Solution Manager.







We will use the URL generated here in our SAPUI5 application as well.





 

Build the application


In order to create our SAPUI5 application, we launch the Web IDE from our SAP Cloud Platform account.








From the IDE workspace, select the File Menu and click on new Project from Template and select an SAPUI5 application.








API access






In the control file (controller.json) in the workspace, we need to put the necessary code to get the data from the API.







The SAPUI5 code snippet contained in the API Business Hub needs to be pasted into the controller.json file.






It is also important to replace the placeholder URL in the code with the ID number of the gadget we want to get the OData from. In this case, it will be the gadget 441.









Interfaces building






It is also necessary to modify the manifest.json file and put the above mentioned URL into the data sources.







The XML view file used to create the interface, is then changed by adding a simple chart giving the value for each hour of the retrieved dimension.








 



Test the application


By starting the index.html file you can test the application. It will give us the chart and the values will appear when we hover our graphs.