SAP Cloud ALM Extend with APIs (Part 2): Get started with SAP Cloud ALM API
Let’s go over the basics of how you would get started using SAP Cloud ALM API:
- Select an API, Understand the API documentation, Try out the API
- Create a service instance, Assigning authorisations, Generating API keys.
- Build your application, Operating over the APIs resources.
Select an API
First things first, you’ll want to find an API you could integrate into your scenario.
All SAP Cloud ALM APIs are published in the SAP API Business HUB: https://api.sap.com/ under the SAP Cloud ALM API package. You just need to search for the API catalog.
Review the API documentation
The API Documentation is the contract between SAP Cloud ALM, and the consumer of the API. It describes the reference format and follows the OpenAPI specification to let you effectively use and integrate with the selected API.
The OpenAPI specification is enriched by examples and tutorials accessible in SAP Cloud ALM help portal https://help.sap.com.
Try out the API
Once logged into the SAP business API HUB, individual APIs can be tested either from the CALM public sandbox tenant or from your own CALM demo tenant if you have one already.
To test API from the CALM sandbox tenant, you need to select the Sandbox API Environment and click on the Try out button.
Depending on the API resources selected, you may need to describe an HTTP request payload or HTTP request parameters.
Then the execute button will trigger a call to the selected SAP Cloud ALM tenant.
If the call is successful, the response body can be inspected in the window below:
SAP Cloud ALM APIs are accessed via OAuth protocols. OAuth essentially allows access tokens to be issued to third-party clients by an authorisation server, with the approval of the resource owner.
Create a service instance
To expose and consume public APIs from your SAP Cloud ALM tenant, you have to create a service instance and associate scopes to this service instance.
- From your SAP BTP sub-account, select your SAP Cloud ALM tenant.
- Create a service instance from the Service Instance
- Enter your instance parameter:
- Service: SAP Cloud ALM API.
- Service Plan: Standard.
- Instance Name: Name your Service Instance.
For more information, see Creating Service Instances in Cloud Foundry.
Set access permissions when interacting with the APIs.
- From the SAP BTP cockpit, update the service instance:
- Select the scopes to be attached your service instance by specifying the corresponding JSON format:
You can access the official documentation here: Manage service keys
Generating API keys
- Select the service instance in the list. Click on create to create a new key.
- Select the scopes to set access permissions to your service instance:
- Check the following parameters:
- client_id: public identifier for the service instances
- client_secret: known only to the BTP service broker and the authorisation server.
- token_URL: “https://<calm_tenant>.authentication.<region>.hana.ondemand.com”,
Third-Party, external application can then consume SAP Cloud ALM API via http client using SAP Cloud ALM APIs tokens.
In the next blog, we will discuss how to work the SAP Cloud ALM Analytics API in the SAP API HUB.
Thanks for reading.