· 

Create API requests in SAP Datasphere with Postman

This is the first in a series of articles about the SAP Datasphere API and what you can do with it. I will start by explaining how to configure the OAuth and start with the first request using Postman. Postman is a tool for creating requests to web services. 

 

So let's dive into it. If you want to consume the SAP Datasphere API, you need to find the right endpoints. A good place to start is api.sap.com. But how can we test and see if the request is correct? If we get the right result?

 

In this post, I will go through the configuration of Postman that allows you to send requests and also receive data from those requests. To do this, we use OAuth technology. I won't explain what OAuth is. If you are interested, take a look at Wikipedia

 

Basic OAuth logic
Basic OAuth logic

First, we need an OAuth connection. To create an OAuth connection, go to your SAP Datasphere tenant and select System >> Administration >> APP Integration. There you will find the authorization and token URL that you will need to create a token later.

OAuth URLs
OAuth URLs

Now we need to create a client so we have a client id and a secret id. Click Create New OAuth Client.

Create a new OAuth client
Create a new OAuth client

Define a name, the purpose, a redirect URL (in this case http://localhost:8080), and as of release 2024.8 you can also define some details about the token. After clicking add, the new OAuth client is created. Now we need the secret and the client id for authorization. Copy the OAuth client ID and secret for later use. 

 

Now we have everything we need to access the API. Let's switch to Postman, you can use it either on the web or via the downloaded program. Visit https://www.postman.com for more information.

Create a new request in Postman
Create a new request in Postman

Go to the Authorization tab, select the OAuth 2.0 type, and select Request Headers for the "Add the authorization information to" section. Now we need to add the token information.  

 

  • Use token type: Access Token
  • Header Prefix: Bearer
  • Auto-refresh token: True
  • Grant type: Authorization Code
  • Callback URL: http://localhost:8080
  • Auth URL: Auth URL from the Datasphere tenant (e.g. https://xyz.authentication.eu10.hana.ondemand.com/oauth/authorize)
  • Access Token URL: Token URL from the tenant (e.g. https://xyz.authentication.eu10.hana.ondemand.com/oauth/token)
  • Client ID: Client ID from the OAuth we created earlier
  • Client secret: Client Secret we get earlier from the OAuth.
  • Client authentication: Send as Basic Auth header

Click "Get New Access Token" to create a new token. This will take you to your SAP Datasphere login page, where you will need to log in for the first time. You will receive the token and can use it. 

 

Now we are ready to kick against the Datasphere API and get some results. To give you a first look at the API, we use the following URL https://xyz.eu10.hcs.cloud.sap/api/v1/dwc/catalog/spaces to get a result of all the spaces. As you can see in the screenshot below, the http status is 200. This means that the request was successful.

 

The next post will go deeper into the API endpoints and some use cases.

Result of SAP Datasphere API
Result of SAP Datasphere API

Conclusion

This is the first of a series of posts about the SAP Datasphere API. I hope you now understand the basics and how to check if your requests return data or if something went wrong. There is also an old post in the SAP community about Postman configuration. But as far as I know, sometimes SAP deletes all the old stuff, and you cannot find it anymore. So feel free to use the comments and give me some ideas what I should show with the API in the next posts.

author.


Hi,

I am Tobias, I write this blog since 2014, you can find me on Twitter, Facebook, and YouTube. I work as a Senior Business Warehouse Consultant. In 2016, I wrote the first edition of Analysis Office - The Comprehensive Guide. If you want, you can leave me a PayPal coffee donation. You can also contact me directly if you want.


Subscribe


  • In my newsletter, you get informed about new topics
  • You learn how to use Analysis Office
  • You get tips and tricks about SAP BI topics
  • You get the first 3 chapters of my e-book Analysis Office - The Comprehensive Guide for free
* indicates required

You want to know SAP Analysis Office in a perfect detail?
You want to know how to build an Excel Dashboard with your Query in Analysis Office? 
You want to know how functions in SAP Analysis Office works?

 

Then you have to take a look into Analysis Office  - The Comprehensive Guide. Either as a video course or as an e-book.


Write a comment

Comments: 0