january 2025.

SAP Datasphere API and Python Authentication

Now that we know how to get data from the SAP Datasphere API using Postman, I want to automate the steps using Python. In this post, I implement authentication via OAuth. I use the two existing libraries OAuth2Session and urllib.parse. 

 

To create the OAuth request we need the secret, the client ID, the authorization URL and the token URL. I stored all this information in a JSON file so I can read and process it. Where to get this information can be found in the earlier post. So we need to read the JSON file first to get all the parameters.

 

secrets_file = path_to_the_secret.json

f = open(secrets_file)
secrets = json.load(f)
print(secrets)

 

Next, we need to encode the client ID, as described by Jascha in this post. I use the urllib.parse.quote functionality for this..

Read More 0 Comments

Deeper Look into SAP Datasphere API

Now that we know how to use Postman to send an API request to SAP Datasphere and receive data. We can now take a closer look at the API and what we can do with it. At api.sap.com we get different API endpoints, I want to focus on the consumption part. The API reference for the consumption part allows us to consume relational and analytical models. 

 

Let's start with the relational models and retrieve the data with Postman to see some results. The relational API endpoint can be accessed at this URL

 

https://xyz.eu10.hcs.cloud.sap/api/v1/dwc/consumption/relational/{space}/{asset}/{technical_object}

 

You can find the exact description in the API catalog. So I won't copy and paste the content here.  Now let's get the data with the above URL. My view is called DBV_BIKE_DELIVERY. If I now use my OAuth from the last post, I get the data directly in Postman.

Read More 0 Comments

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

 

Read More 1 Comments