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.
Provisioning
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:
Property | Value |
---|---|
Name | SAPDevSystemES4 |
Description | SAP Developer System |
Host | sapes4.sapdevcenter.com |
Port | 443 |
Path Prefix | /sap/opu/odata |
Use SSL | True |
Authentication Type | Basic |
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.
Properties | Value |
---|---|
Name | EPMData |
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!
Consumption
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.
Stay tuned!
—
Update: for more information see SAP API Management – Overview & Getting started
Hi Holger,
The following link states the access to backend systems on premise, is via reverse proxy. Does it mean, accessing them for API Management via HANA Cloud connector is not possible?
SAP API Management
Thanks,
Amol
Hi Amol,
you are right. As of today with the current release of SAP API Management the HANA Cloud Connector is not yet supported. We are working on several options on how to best support and enable HCC, but for now you have to use a reverse proxy.
Regards,
Holger.
Thanks Holger,
I attempted to connect to a system other than ES4. When I click on Create API, i get the following error
[Request ID: c249a656-9ee0-4000-bc9b-048429bc5641] Unable to fetch data from catalog.
I dont see any way to see more detailed logs / traces on the API portal part of the service. How can this be drilled down further?
Note: When I do a "Check Connection" from the destination , it shows that the following message,
Success: Connection to "XXXXXX" is Successful
which should mean that there is no basic issue like connectivity.
Thanks,
Amol
Hi Arnol,
is the system currently accessible via the internet / a reverse proxy? Can you access the Gateway Catalog service directly (without API Management)? As mentioned we have not yet relesed an option to work with the Cloud Connector.
Regards,
Holger.
Hi Holger,
Yes, the system is currently available over the plain internet and if I see the below URL in browser, I can see the service listing, after providing the credentials in the Basic Auth popup.
http://<domainname>/sap/opu/odata/IWFND/CATALOGSERVICE/ServiceCollection?sap-client=200
Just to confirm, I am not trying to use an internal system via cloud connector.
Thanks.
Hi Amol,
One thing to check, when you configured the system in your Systems area (under Configure), did you also configure the authentication in the HCP API Management Destinations area, with some valid credentials?
The API Management system needs to be able to authenticate itself against the BE system in order to fetch the list of Services from the Service Catalog.
Additionally ensure that the URL to your catalog is correct, for example above you stated http://domain/path ; if you are using http you will need to specify the http port (rather than https), etc. The "Check Connection" button is essentially just a Ping, to ensure that the host is reachable, but specifics, such as port and path will not be tested.
Regards,
Elijah
Hi Elijah,
Yes, I did configure the valid credentials , since, you anyway get a message to do so when you add the system and I did modify the automatically created destination at service level.
Regarding the second point about port, I had to anyway specify the port as 80 explicitly, without which the validation doesn't save the data e.g. it states invalid port. In the authentication part, Use SSL is not checked, and authentication type is set to Basic Auth.
Thanks,
Amol
Hi Amol,
Can you provide a screenshot of your settings both in the API Management services screen, as well as the HCP API Mgmt Destination? You can of course remove any sensitive data such as the URL for your system, and credentials; often times it is a small misconfiguration which can cause these issues.
Thanks,
Elijah
Hi Holger, amazing and detailed Article.
Unluckily, at the Product creation step I get this error every time I try to publish it :
In my HCP trial, the Destination Configuration settings for SAPDevSystemES4 is:
Proxy Type is Internet,
BasicAuthentication with my trial "S.....trial" USER ID.
I've also tried adding Additional Properties like "TrustAll = true" or "jco.destination.auth_type = TrustAll" but with no success.
I've no Idea!!!!
Regards,
Stefano
Hi Stefano,
but you were able to create the API Proxy, right? "only" the publishing step fails?
Regards,
Holger.
Absolutely!
Following the steps in the Tutorial i can create the API proxy without any problem.
the procedures stop with the Error mentioned above when I try to Publish the new Product set as in the demo.
Hi, just to let others know: There was an issue with the user assigned to the role AuthGroup.ContentAuthor. Once the user was assigned again it worked.
Regards,
Holger.
Hi,
When I try to create the API Proxy by selecting the system from Provider System drop down, and then click on Discover is giving the below error:
[Request ID: 659b949f-3453-4d76-966d-d9ccf0692cd3] while trying to invoke the method org.apache.olingo.odata2.api.edm.EdmEntitySet.getEntityType() of a null object loaded from local variable 'entitySet'.
I have validate my Catalog URL is working in browser.
Thanks
Hi Chede,
I am getting the same error. Let me check what's going on...
Regards,
Holger.
Hi Holger,
Could you tell me how to resolve this problem, i am getting the same error in my system
[Request ID: 7ad3b1ae-ba16-4c7c-99cd-cbecf0bba1e3] while trying to invoke the method org.apache.olingo.odata2.api.edm.EdmEntitySet.getEntityType() of a null object loaded from local variable 'entitySet'
Hi feng tang,
Did u get the solution for this?
Even I am getting the same error message on click of discover.
Could you tell me how to resolve this problem?
Regards,
Raghavendra
Holger,
Thank you for checking, now its working.
Thanks
Chede
Hi Holger,
Trying to add a RESTful service hosted on my trial account, no authentication, and destination works when testing.
I'm able to create an API, but when clicking save (on Create API page) I get an error:
Request URL:https://apiportalu34f5b50f-[my]trial.hanatrial.ondemand.com/apiportal/api/1.0/Management.svc/APIProxies
Request Method:POST
Status Code:403 Forbidden
My user is assigned to all roles available in API Management API Portal.
Regards,
Nic
Hi Nic,
When you say your user is assigned to *all* roles, do you mean that your I# is assigned to every role type? Or simply the default?
There was another user that stated that having too many permissions actually caused some issues for him when attempting to create and save APIs.
On my account my I# is only assigned to the role APIPortal.Administrator (and p1940842373 is assigned to APIPortal.Service.CatalogIntegration, APIManagement.Service.Administrator, APIPortal.Service.Administrator ). Can you verify if your setup matches this?
Thanks,
Elijah
Hi Elijah,
Yes that was spot on. I unassigned all user ids from all roles. And then I added according to your suggestion.
Now it works.
Thanks,
Nic
Great, glad to hear you got it working
Hi,
While publishing the Product, I am getting this error.
[Request ID: f221030e-0d5f-43b0-932b-1f6612dd06aa]
while trying to invoke the method org.apache.olingo.odata2.api.processor.ODataResponse.getStatus() of a null object loaded from local variable 'response'
Thanks
Chede
Hi Chede,
we are right now in the process of updating the trial landscape. Maybe this caused your issue. Can you try again later? I will also give it a try later today.
Regards,
Holger.
Holger,
this article is great.. I had started something similar but you nailed it ! great job
I tried again, now Quota is mandatory.. I just entered some numbers there and Product Published.
Thanks
great article Holger.
I was able to do all the steps and it worked as described. looking forward to see more articles on policy management as this seems to be the heart of API Mgnt.
Regards
Matthias
Hi Matthias,
Don't forget to check out SAP API Management - Overview & Getting started which will be a repository of expanding content around policies.
Hi,
Like some others, I am having some difficulty at the API creation part. Once I click on discover I get the error message regarding unable to fetch data from the catalog. When I enter the url in my browser I can see my service collection (and when I drill into my collections I can see the data they contain).
I've tried some of the recommendations outlined here and on some other pages too such as re-assigning user roles etc - is there anything else I can try?
Regards,
Geoff
Hi Geoffrey,
Are you still having this same issue? And if so, can you ensure that your credentials are entered correctly for the System?
So far, every issue of "unable to fetch data from the catalog" was an issue of invalid credential settings, rather than a role issue.
Regards,
Elijah
Hi Elijah,
Have checked this and seems ok - have also tested with auth set to none. I can get the GWDEMO app working just fine but not our own appliaction. Have tried using odata v2 and v4 applications but no luck so far.
Looking at the service catalogue defination for the GWDEMO app and our app's there is some differences so will investigate further there. If I find anything useful I will reply to the thread.
Regards,
Geoff
Hi Holger, this API management tool can connect to SAP Business One Integration Framework (B1if) and B1iSN? Is there any doc supporting that?
Many Thanks!
Hi Silvio,
since SAP API Management is not limited to a specific backend (even not limited to SAP backend systems) you should also be able to connect and manage services from SAP Business One.
Regards,
Holger.
Thanks for the reply Holger.
Will give it a try
Regards
Silvio
Hi ,
Create API is not enabled by default.
I checked the roles and I have the roles assigned to me as specified above in the thread.
Once when I uncheck Link API Provider option , create gets enabled.
Then again check the Link API provider option and click on create ( create still in enable state) , nothing works . ( API is not created and no error message as well ).
Could you please help here?
Thanks & Regards,
Akila Sangili.
Hi Akila,
is it possible that you are trying from Internet Explorer? Can you please give another try with Google Chrome?
I was facing a very similar issue the other day and it got resolved by switching to Chrome.
Thanks,
Holger.
Hi Holger ,
Thanks for the suggestion.
It worked in chrome.
Thanks ,
Akila Sangili.
Hi ,
Struck with application creation as create option is unavailable on Application tab . Tried in IE/ Chrome / firefox.
Can you please guide me on finding any missing roles which is the root cause for this?
Thanks & Regards,
Akila Sangili.
Hi Akila,
are you logged on in the developer portal? I guess you are using all of this on HCP Trial. Do you see the Subscribe button? Can you share some screenshots to get a better understanding where you are (all required roles should be assigned to you automatically on HCP Trial).
Regards,
Holger.
Hi Holger,
Subscription was missed out at my end that caused the issue.
Thanks for your support.
Regards,
Akila Sangili.
Hi Holger,
I am unable to enable API management service in HCP trial on my S-user. When I click on Enable button, The service is getting failed. Any other configuration is required to enable the SAP API management service? Can you please advice on the issue?
Thanks,
Ankit
Hi Ankit,
can you wait a little and click on Enable again. Sometimes activation failes during first try.
If it still does not work, we can look into your S-user.
Regards,
Holger.
Hi Holger,
Tried multiple times, its goes to processing state on clicking enable and then goes to failed state. please let me know support email contact where I can forward s-user details.
Thanks,
Ankit
Hi Holger,
When will API Management fully support the use of Hana Cloud Connector ? Or is a reverse proxy still required?
Regards,
Bert
Dear Holger,
great tutorial!
Unfortunately, I'm having trouble creating an application. The "Subscribe" button is missing.
Im using the Trial Version and Im in the Developer Portal..but i cannot find the button to create a Application.
Could you please help me with this?
Thanks!
Nadine