How to use SAP API Management on HCP Trial
It is a busy time for the “SAP API world”. Last week we announced the SAP Hub (Beta) on HCP Trial and this week you might have seen the blog from my colleagues Divya Mary on the release of the SAP API Management on HCP Trial.
This means that you can now enable your own API Management Portal and Developer Portal and start experiencing what the SAP API Management is all about.
In this blog I want to outline the concepts and first very basic steps to get you started. I will not yet cover some very important pieces like API Key Verification, Throtteling, URL Masking, Quota, Authentication or any of the other cool stuff that is possible. I just want to outline how you can use the SAP API Management Portal to create an API and then expose it to a developer community.
To start with I will use my favorite service GWSAMPLE_BASIC from the ES4 system (of course you can consume this service directly without an API Management; just imagine that this service would not be accessible directly and that you would need to secure it, that you want to learn a little more on who and how often different services are being used, …) — we will cover all these aspects over the next few week.
For the next steps, I assume that you have enabled API Management in your HCP Trial. Just follow the steps outlined by Divya in her blog.
For the provisioning part we will look at an API Owner who uses the SAP API Management Portal to create and maintain APIs. Lets start by logging on to the SAP API Management API Portal ( HCP Trial Account -> Services tab under -> Integration category -> SAP API Management)
The screen you can see now is to configure systems. Right now the list is empty.
Creating a System
The first step of the API Owner is to create a system. A system in API Management is a destination in HCP which allows you to connect to the backend systems from which you want to expose and manage your APIs. Following the Fiori UX click on Create on the bottom right corner. This will open the screen to Add a system
Fill in the properties like:
|Description||SAP Developer System|
|Service Catalog URL||/IWFND/CATALOGSERVICE/ServiceCollection|
Before you click on Save you can also validate the Catalog URL and copy & paste the URL in your browser. As a result you should see the probably familiar Catalog Service from ES4 (if you never accessed ES4 or if you need to reset your passwored, please check out this blog: Sign up and get started with the SAP Gateway – Demo Consumption System):
Back in the System screen, make sure to click on Save now.
Since we have selected Basic Authentication we want to maintain the credentials. That can be done via the HCP Destination. So from the System view (see above) click on the Launch link which will open the Destination tab in your HCP Trial Account -> API Management Subscription.
Note: If this does not work, please go back to the HCP screen where you had enabled SAP API Management Trial and click on “SAP API Management API Portal (Roles & Destinations)”. From here you can access the destinations.
In the destination you will be able to see the system that you just created in the SAP API Management Portal and can modify the configuration:
Click on Edit and enter your credentials for the ES4 system:
Creating the API Proxy
Now we can continue with the next step which is creating an API Proxy. Back in the SAP API Management Portal click on the hambuger menu and select Manage.
Similar to creating the system, the overview screen does not yet show any APIs. So click on Create -> Create API (the Import API can be used to easily transport APIs from a Test or QA API Management Portal to the next environment)
From the Provider System drop down select the system we just created and click on Discover:
This will connect to the catalog service on ES4 and retrieve the list of available OData service. Just search for “SAMPLE” and you will see the famous GWSAMPLE_BASIC service:
When you click on OK, the remaining fields will be populated. You can also leave the Documentation switch on Yes so that the available information from the OData service is used as a basis for the API documentation.
With that we have created the API Proxy. In the overview screen you can see the available resources — all of this information was automatically retrieved from the OData service. You can see which resources allow GET, POST, PUT, or DELETE operations. You can also go deeper and adjust the documentation which was generated automatically:
Once your are done with your adjustments (you do not have to do anything :-)) just click on Save.
Of course you could now go on and add Policies or additional configuration, but for this very first blog we will skip this step.
Creating a Product
Developers working with the API Management Developer Portal will actuall develop their applications not on APIs, but on Products. So the next step is to create such a product and assign APIs to it. Go back to the APIs Overview screen
switch to the Product tab, and click on Create
Enter a product name and add the API that we just created.
|Title||Enterprise Procurement Model from GWSAMPLE_BASIC Serivce on ES4|
|Description||This product exposes data from the GWSAMPLE_BASIC service hosted on the SAP Developer Center system. You can access data from the Enterprise Procurement Model.|
For now we will again not do anything special and not assin any Quota. Instead just click on the “+” symbol in the API line
and add the API that you just created (a product could contain more than one API, but right now we only have one :-))
With these settings we can publish the product!
That’s it on the provisioing side.. We now have one product that a developer can discover, subscribe and use.
So lets’s switch personas!
Back in the HCP Trial Account, where you activated the SAP API Management, there was another link to the SAP API Management Dev Portal.
We now pretend to be a developer who wants to learn a little about enterprise procurement and needs to get started. The developer does not know much about SAP, but has found a SAP API Management Developer Portal (granted, the URL does not look very nice right now — for me it is something like devportal-blablabla-myaccount.hanatrial.ondemand.com/#/shell/discover — but obviously this could be beautified)
Well, as a developer I now reached this portal and I can see that there is one product available (actually the following steps are exactly the same as the ones outlined in the SAP API Hub (Beta))
Click on this Product and you can see all the details that we previously provided as the API Owner. You can also take a look at the API Proxies which are available via this product.
You can either Subscribe (which we will do in a second), or you can take a closer look at the API (just click on the API). From here you can see the the API Proxy URL, avaialble operations (GET, POST, …) and can even give them a try (just click on the GET Method for the Business Partner Resource):
In the API Test Console click on the Authentication Link and provide your username and password for the ES4 system:
Now just make sure that you select the HTTP Method GET and click on Send.
As a result you will see the response from the BusinessPartnerSet Collection in the GWSAMPLE_BASIC service.
Now that we have tested that, lets go back
When you subscribe to a product you can create a New Application for which you will get an API Key (as me
ntioned before, right now you do not need this key since we did not implement any API Key verification steps — that’s for the next blog to cover)
After saving the New Application you can switch to the consumption view
where you will see your Application
and the generated Application Key.
With that we have everything to really get productive with the API Management. We have exposed our very first API which can be discovered and consumed via a Developer Portal. Granted, the value-add because of the steps outlined above is fairly limited. But in the next few weeks we will show you how you can monitor your calls, secure them, throttle them, enhance them, … which will really show the power of SAP API Management.
Update: for more information see SAP API Management – Overview & Getting started