If you are not already familiar with the Cloud Management APIs of SAP Cloud Platform, today is a great day to get started.
The APIs of the Cloud Management service gives you the freedom to do the following without having to access the SAP Cloud Platform cockpit:
- View and manage your account
- Set and view your entitlements
- Register or provision subscriptions and services to your subaccounts or directories
Recently, our API shop moved from a homegrown Swagger to SAP API Business Hub . It includes the complete set of core APIs for SAP Cloud Platform. And if you ever worked with APIs before, you probably know that you need a token
Why you should read this blog?
In this blog, I‘ll show you step by step how to get a token in SAP API Business Hub so that you can get any API endpoint working for the Cloud Management service. Along the way, I’ll also discuss some concepts and I’ll walk you through some of the UIs… and we’ll also have some fun!
Before we start, a few words about “central“ and “local“
In SAP Cloud Management APIs, there are services that operate at the central level and there some that operate at the local level (some work at both). Central level APIs are not bound to a specific region, while the local APIs are, just like a subaccount is a regional entry.
Let’s look at an example, where we have this group of subaccounts:
When I created the DEV-US subaccount, I needed to choose a region in which to create it:
So, to manage the DEV-US subaccount, I‘ll need to call the US10 APIs.
Don’t worry, if you don’t remember which of the services work for both central and local… we‘ve made it easier for you in the SAP API Business Hub by entering the relevant one in each API (I will discuss this a little later). Just be aware of this so that you always get the results that you are aiming for.
Getting a token the easy way
We came here to perform a task, so the first step is to pick the proper service for it. Let’s say we want to view the service instance details within the DEV-US subaccount.
In this flow, we need to work with the Provisioning service API in the local US10 region.
Go to the Settings section by clicking on the cog icon. This screen will open:
You can set quite a few properties here, so let’s review the important ones.
The Starting URL lists all the regions that you can use to work with the Cloud Management services. Let’s pick us10.
The other important properties are :
|Client ID||The OAuth 2.0 client ID.|
|Client Secret||The OAuth 2.0 client secret.|
|Identity Zone||The User Account and Authentication service supports the concept of identity zones to isolate OAuth 2.0 clients|
|Username||Your email in SAP Cloud Platform|
|Password||Your password in SAP Cloud Platform|
To find the values needed for the client ID, client secret, and identity zone, you need to get them from the local or central services‘ key.
To create them, you need to go to the SAP Cloud Platform cockpit, and then in your subaccount‘s Service Marketplace page, search for “Cloud Management“.
To find the values needed for the client ID, client secret, and identity zone, you need to get them from the local or central services‘ key. You can find this blog a step by step guide.
If you have a subaccount in another region, you will need to follow the same flow and use the properties you created there.
So now you have what you need to get a token, and you can also save it for future use and for the entire Cloud Management APIs package:
To use it now, you can simply go to the API endpoint that you want to work with and click on “Try out”, then click Execute“:
You will get the response from the API based on the subaccount for which you supplied the access token.
Side note If you used our homegrown Swagger API before, this is the same response you would get when using the API endpoint after applying the Bearer token.
From this point (if you checked “Apply this environment to all APIs in this package that are not yet configured”), you can now simply pick the service you need and switch to the environment you want to work with by picking it from the dropdown list.
To summarize, we are constantly trying to make the platform easier to ease. This new feature in the SAP API Business Hub is a big step in this direction.
That’s if for now, keep on clouding…