Skip to Content
Author's profile photo Former Member

How to use SAP API Hub (Beta)

— Update —

 

SAP API Hub (Beta) is now SAP API Business Hub!

My colleague Bjoern Woppmann has created a fantastic guide on how to get started, Testing and Exploring APIs on SAP API Business Hub

 

— Update —

 

My colleague Ralf Schaub introduced the SAP API Hub. Going forward we want to provide our customers and partners one place where you can easily discover, access and subscribe to APIs offered by SAP (and later on by partners as well).

 

As you might have seen right now the content in the SAP API Hub (Beta) is quite limited but over time we will add more and more. In order to show you how you can work with the content offered I want to go through one example using a service from the SAP Translation Hub.

 

When you access your SAP HCP Trial instance and go to Services you will see one new entry: the SAP API Hub.

 

01 - Services - API Hub.png

By default it is already enabled so if you click on it you can find the usual description and the URL to access it.

02 - SAP API Hub.png

 

 

Once you do that you will see all the content that is currently available via the Hub:

03 - API Hub Content.png

 

As mentioned the content is quite limited right now, but we are in Beta and working with different teams within SAP to get more and more content over time. For now let’s click on the SAP Translation Hub API Icon, which will provide more information on the available APIs. The package that contains the APIs is called a Product. So in our case the “SAP Translation Hub API” is a product that contains APIs which allow you to leverage translation services.

04 - SAP Translation Hub.png

 

Usually you would first take a closer look at the APIs which are part of this Product, but since we already know that we want to use services out of the SAP Translation Hub API, lets immediately subscribe to this Product. This will later allow us to consume the services using an API Key.

So in the lower right corner click on Subscribe and select “New Application” — which means that we want to use the APIs belonging to this Product in our Application.

05 - Subscribe.png

 

As a next step we need to provide a name and description for our new application:

06 - Create Application.png

 

With that we can finally take a closer look at the available APIs (again, this is something that you would usually do upfront – now we just want to take a closer look at some of the features that the SAP API Hub Beta has to offer):

07 - Product Overview.png

 

The overview page provides some generic information. What is this product used for, how can you access the product (the API Proxy URL) and it lists the available services (the “Resources”). When you click on the Details you can get more information. In our case you get some information with Simple Examples on how you can use these services.

08 - Product Details.png

As you can see one of the variables that we need to provide in order to use the services is the API Key. Since we already have subscribed to the Product, we already access this API Key.

So lets switch from the current Discovery mode, to the Consumption Mode.

09 - Go To Consumption.png

 

From here we can see all the Applications that we have created. As of now it is only our TranslationHub application that we created when we subscribed to the SAP Translation Hub product before. Lets click on this application:

10 - All Applications.png

 

Now we can see the Application Key which we need to call this specific API. Copy this value so that we can use it later.

11 - Application Key.png

 

We will use the Translate service from the Translation Service. Lets take a closer look at what this service has to offer. Click on the SAP Translation Hub Services and expand the Translate Section:

12 - Translate.png

 

You can see the URL, see that it is a POST call and also some other information.

Usually we would now continue to go to the Test Section and test the API.

12a - Test.png

 

Unfortunately (remember, we are still in Beta). Test is not working (we have a certificate mismatch…) so we will need a different tool. I am use the Google Chrome Add-in Postman.

In Postman, select POST, enter the URL

 

https://apihub.hanatrial.ondemand.com/translationhub/api/v1/translate

 

and go to the Headers section. From there add the fields

   

Header Value
Content-Type application/json
APIKey <Paste the API Key value from before>

 

13 - Postman.png

As a last step switch to the Body tab and copy the required content (usually you would get this information from the Description of the individual API).

 

{ “targetLanguages” : [“en”, “de”, “fr”, “bg”, “ru”], bundles” : [{ “units” : [{“textType” : “XFLD”, “value” : “Password” }]}]

}

 

Once that is done click on Send.

14 - Run Postman.png

 

 

As a result you get the translation of the word Password in different languages (I can only verify that the translation of Password to German is “Kennwort” — so great! That worked 🙂

 

I hope that the steps above provided you with a first glimps of what you can do with the SAP API Hub (Beta). It is still in Beta and we will add more and more content to it in the coming weeks and months. So stay tuned for more updates…!

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Matthias Steiner
      Matthias Steiner

      Great primer Holger - thanks for the write-up!

      Author's profile photo Amber Badam
      Amber Badam

      Useful info.nicely articulated

      Author's profile photo Former Member
      Former Member

      Dear Holger,

      Thank you for the very informative session. Can you please also show us how it would be able to create own APIs for exisiting non-SAP Software like Google, Yahoo or LinkedIn?

      Thank you!

      Author's profile photo Elijah Martinez
      Elijah Martinez

      Hi Simon,

      Much has changed since this blog was written, however one thing is still currently the same, and that is that the SAP API Business Hub is a catalog for SAP APIs, and SAP Partners who wish to invest in the API Business Hub. We would need to work directly with Google, Yahoo, or LinkedIn, etc. if they wished to add APIs to the Business Hub (after validating the scenario for the API) to ensure quality and stability of the API. The Partner portion is still new and getting off the ground, so it will take some time before this is streamlined.

      You may contact SAPAPIHubInfo@sap.com if you are interested in such an opportunity.

      Regards,
      Elijah

      Author's profile photo Bhaskar Tripathi
      Bhaskar Tripathi

      Hello Holger,

       

      Could you please advice how can we consume API in SAP API Business Hub from SAP Web IDE? I read your blog post, but I don't think that applies to the case I mentioned. Please help.

       

      Best Regards,

      Bhaskar

      Author's profile photo Elijah Martinez
      Elijah Martinez

      Hi Bhaskar,

      The blog you linked is not applicable, yet 😉

      What you can do in the meantime is link API endpoints from the API Business Hub as destinations into your HCP tenant, with the WebIDE flag, which will make them accessible as ServiceURLs.

      I hope this helps, if you would like more information about this, I can create a writeup for you.

      Regards,
      Elijah

      Author's profile photo Bhaskar Tripathi
      Bhaskar Tripathi

       

      Thanks for the reply Elijah.

       

      Unfortunately I have already tried that and its not working.  Please take a look at my question in community Q&A. It gives peer authentication error.

      I also tried just the base URL “https://apihub.hanatrial.ondemand.com/odata/v2/”. Still didn’t work.

      Thoughts please.

       

      Best Regards,

      Bhaskar

      Author's profile photo Elijah Martinez
      Elijah Martinez

      Hi Bhaskar,

      Apologies, not always easy tracking questions on new community, still learning 🙂

      I have answered in the other thread, and will try to monitor both to see if it worked for you.

      Regards,
      Elijah