Quantcast
Channel: SAP APIs and API Management
Viewing all articles
Browse latest Browse all 51

How to use SAP API Hub (Beta)

$
0
0

My colleague Ralf Schaubintroduced the SAP API Hub on HCP Trial last week. 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

        

HeaderValue
Content-Typeapplication/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...!


Viewing all articles
Browse latest Browse all 51

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>