Testing APIs from SAP API Business Hub
6 min read
Are you starting to integrate your SAP Marketing Cloud, or do you already have many integrations up and running? Either way the API's Hub "try out" functionality can help you integrate your Marketing Cloud in getting a better understanding of the provided APIs.
This article provides an overview on SAP API Business Hub and its own “try out” functionality. The functionality is shown using the Contacts API for the SAP Marketing Cloud; however, the principle is applicable for other APIs and other products as well.
Table of Contents
What is the API Hub?
The API Hub is the place to go when you want to find out more about the API’s of your SAP product. You can dive deep into the specifics of a single API or get an overview of all the API’s of a product in its API Package. This guide will walk you through the API Hub and some features that you may not have heard of.
Finding the Correct API
Given the amount of API’s, you will want to use the search functionality to find the correct API’s of your
product. Using the Filters on the left you can search for a specific type such as a single API or a complete
Once you found the desired API Package you can scroll through all the available API’s of the chosen
In case you don’t see the desired API right away, make sure to scroll to the bottom as more load while scrolling
If you are already familiar with API’s you have probably heard of Applications like Postman, Postwoman, Paw, API tester, etc. All of those let you play extensively with an API and some of them can do very complex requests and even automations. But if you just want to get a feeling for an API or check whether the API is reachable, those tools might be overkill.
This is where the testing functionality of the API Hub comes in. It provides a very easy interface to test the API, without the need of a third-party application. While a simple interface is always welcome, what it really sets apart is the ability to configure your own hosts. This means you can link your very own SAP product as a target to test the API on. Hence, you can try all the API’s on your system once you added your system to your profile, without having to worry about authentication.
In order to configure your system as a target destination of the API you need to be logged in with your (S-) User on the SAP API Business Hub.
To Configure your environment, click on “configure Environments”:
In order to add a new Environment, you need to have a communication arrangement set up which exposes the desired API. If you already have a communication arrangement in place you can fill in the information as follows:
- Host: The API URL of your system. This looks something like “my987654-api.s4hana.ondemand.com”.
- Port: 443 (default port for https communication)
- Technical User credentials from the communication arrangement.
In order to be able to communicate with your own SAP Marketing Cloud (or other product), the product needs to expose the interface for the API. For the SAP Marketing Cloud this is done via communication arrangements. In case you haven’t set up a communication arrangement in your Marketing Cloud please follow this article to set up the communication arrangement for your desired API:
For the Conctact API the communication scenario is set up like:
|Communication Scenario ID||SAP_COM_0207|
|Communication System Host||API Hub (dummy)|
Make sure you get the correct Scenario ID for the desired API. The Communication Scenario lists the availlable APIs once it is created
Try it out
Now that everything is set up and configured, it’s time to check out the API’s on the API Hub using the "Try Out" function. In this article we will look at the Contact API to read some contact data. Once you developed a feeling for the functionality of one API, you will discover that other API’s are just as easy.
Choose your desired API and click on the “try out” button:
Fill in the desired data in the request fields and make sure you select your environment:
Once you are ready with your request, click "Execute".
A few seconds later you should have a response with data from your own system:
And there you have it, you just tested an API from the API Hub on your very own SAP Product, congratulations!
This article introduced you to the SAP API Business Hub and the try out function. Thanks to the try out function you can get a better understanding of the API through hands on experience using the API with a sandbox system. With the configure "environments functionality" you can even add your own system as a target system. Once your system is linked, you can test the API’s directly with your very own system.