Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member


--- Update ---

 

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

My colleague bjoernw 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.

 



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



 

 

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



 

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.



 

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.



 

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



 

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):



 

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.



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.



 

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:



 

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.



 

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:



 

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.



 

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>

 



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.



 

 

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...!

8 Comments