SAP Cloud ALM, the SAP Application Lifecycle Management platform for cloud-centric customers was
launched in May 2020. Since then, additional services and features are added regularly. In the area of APIs, the SAP Cloud ALM Analytics API is live for customers and partners since September 2021. The documentation and sandbox for this API are available from the
SAP API Business Hub.
SAP Cloud ALM offer two flavours of analytics interface: REST and REST/OData. While those two types of interfaces accept different syntax, they provide you access to the exact same data with the same set of dimensions, measures and attributes.
Interface |
Type |
Description |
DataSet |
REST/OData |
Provide access to all analytics data and metadata (dimensions, measures, attributes) |
Provider List |
REST |
Returns the list of data providers available |
Provider Filters |
REST |
Returns the dimensions, measures, and attributes of a data provider |
Provider Data |
REST |
Provide access to all analytics data |
In this blog, we look at Analytics
OData interface of SAP Cloud ALM and how we can call it using a simple REST client like Postman. As an example, we query the analytics data provider PROVIDERS_LIST which is a special data provider, a catalog, referencing all the others data providers.
As a prerequisite you’ll need:
- SAP Cloud ALM tenant
- REST client like Postman
Get your SAP Cloud ALM credentials
SAP Cloud ALM public APIs are protected with
OAuth 2.0 Client Credentials grant flow.
We need an OAuth key to access the SAP Cloud ALM tenant; This is done from SAP BTP cockpit, within a Cloud Foundry space. You can find more information on how to get the credentials
here.
Setup your REST client
Below you’ll find information how to setup Postman to call the OData interface. It might off course be different with another REST client.
You need to select “OAuth 2.0” as type of authorization and “Client Credentials” as grant type.
The parameters you need to setup OAuth 2.0 (client id, client secret and token URL) come from the SAP Cloud ALM key you created in the previous step.
Once the authorisation parameters are properly configured, you can request a token with button “Get New Access Token”. The token can then be used to call OData Analytics interface of SAP Cloud ALM.
About the URL
In the following examples we access SAP Cloud ALM on European
region “eu10”. While the host part of the URL would be different if you access another region, the path is always the same whatever the region:
List all data providers
With this query you can retrieve all analytics data providers offered by SAP Cloud ALM. Below the generic dimensions selected in the query ($select):
- d2v: technical name of the data provider
- d3v: description of the data provider
- d4v: version of the data provider
https://eu10.alm.cloud.sap/api/calm-analytics/v1/odata/v4/analytics/DataSet?$filter=provider eq 'PROVIDERS_LIST'&$select=d2v,d3v,d4v
List all dimensions of a data provider
The following query shows how we can retrieve all dimensions of an analytics data provider. In this case, we request all dimensions of data providers
DP_TASKS.
Below the generic dimensions selected in the query ($select):
- d2v: name of the dimension
- d3v: description of the dimension
- d5v: keyword “DIMENSION”
- d6v: generic id for the dimension’s key
https://eu10.alm.cloud.sap/api/calm-analytics/v1/odata/v4/analytics/DataSet?$filter=provider eq 'PROVIDERS_LIST' and query eq 'provider=DP_TASKS;metadata=dimensions'&$select=d2v,d3v,d5v,d6v
List all measures of a data provider
The following query shows how we can retrieve all measures of an analytics data provider. In this case, we request all measures of data providers
DP_TASKS.
Below the generic dimensions selected in the query ($select):
- d2v: name of the measure
- d3v: description of the measure
- d5v: keyword “MEASURE”
- d6v: generic id for the measure’s key
https://eu10.alm.cloud.sap/api/calm-analytics/v1/odata/v4/analytics/DataSet?$filter=provider eq 'PROVIDERS_LIST' and query eq 'provider=DP_TASKS;metadata=measures'&$select=d2v,d3v,d5v,d6v
List all attributes of a data provider
The attributes are used to build the query. For example in the request below the syntax
‘query eq 'provider=DP_TASKS;metadata=attributes' tells us that “provider” and “metadata” are two attributes of analytics data provider PROVIDERS_LIST. This is thanks to the attributes we can shape the result returned by a data provider. In some cases, a dimension is also used as an attribute. For example, with data provider DP_TASKS, "project” and “status” are dimensions as well as attributes.
The following query shows how we can retrieve all attributes of an analytics data provider. In this case, we request all attributes of data providers
DP_TASKS.
Below the generic dimensions selected in the query ($select):
- d2v: name of the attribute
- d3v: description of the attribute
- d5v: keyword “ATTRIBUTE”
- d6v: generic id for the attributes’s key
https://eu10.alm.cloud.sap/api/calm-analytics/v1/odata/v4/analytics/DataSet?$filter=provider eq 'PROVIDERS_LIST' and query eq 'provider=DP_TASKS;metadata=attributes'&$select=d2v,d3v,d5v,d6v