Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
51 views

Data Export API_ A tour of the API - SAP Community

Uploaded by

ARPITA BISWAS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Data Export API_ A tour of the API - SAP Community

Uploaded by

ARPITA BISWAS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

m
m
Products and Technology Groups Partners Topics Events What's New Get Started
u
ni
t
y
SAP Community  Products and Technology  Technology  Technology Blogs by SAP
 Data Export API: A tour of the API

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.

Blog  What are you looking for today?

Data Export API: A tour of the API

david_stocker
Product and Topic Expert

‎2023 Jan 11 1:19 PM

 10 Kudos  10,767

SAP Managed Tags: SAP Analytics Cloud, SAP Analytics Cloud for planning,
SAP Analytics Cloud, data modeling

This is part of a series on exploring the SAP Analytics Cloud (SAC) data export API.
When the series is complete, it will also be available as a single tutorial mission.

We’ve configured our SAP Analytics Cloud (SAC) tenant to accommodate an application.
Now we’ll assume the mantle of that app and explore the export API. I’ll assume that you
have an API tester and know how to use it. You can use any that you wish, but I’ll be
using Postman for the examples. The process of getting data out of a model involves – at
a minimum - the following steps:

1. Get the authorization token for the session

2. List the “providers” (a.k.a. models)

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 1/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

3. Fetch the metadata for s specific model

4. Fetch the audit, master, and fact data for that model, as desired

Authorization Token

Recall from when you configured your OAuth client in the App Integration tab of tenant
administration, that there was some information that you’d need to use later. Specifically,
you’ll need:

1. The token URL from the App Integration overview

2. The Client ID and Secret from the individual OAuth client

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 2/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

In Postman, several REST URL calls are grouped together into a collection and this
collection shares an authorization token. If you look in the authorization tab of your
collection, you can enter this information via copy + paste. For more information on
managing authorization tokens in Postman, you can look in the SAP Help Portal for an
OAuth example and in the Postman Learning Center for more comprehensive
documentation.

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 3/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

The export API URL pattern

All of the URLs in the SAC data export API follow a similar pattern of baseURL + service
endpoint. The baseURL is built up as:

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 4/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

1 https://<tenantName>.<dataCenter>.sapanalytics.cloud/api/v1/datae

So if you know your tenant name and which data center your tenant is on, it is easy to
construct. For individual services, you’ll append the URL "service endpoint" fragment for
the individual service.

All service URL endpoints use GET, not POST. In practice, this means that you’ll be
building up any parametrization in the URL string itself, instead of a json body.

Administration Service URL Endpoints

There are four administration service endpoints.

/administration/Namespaces

/administration/Namespaces(NamespaceID='sac')

/administration/$metadata

/administration/Namespaces(NamespaceID='sac')/Providers

Neither of the first two endpoints returns much of any importance and are there for
OData compliance. There is a single namespace (‘sac’) in the export API, so both return
the same thing; the name and description of this one namespace, in json format.

1 https://<tenant>.<datacenter>.sapanalytics.cloud/api/v1/dataexpor

returns

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 5/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

1 {
2 "@odata.context": "https://<tenant>.<datacenter>.sapanalytics
3 "value": [
4 {
5 "NamespaceID": "sac",
6 "Description": "SAC Namespace"
7 }
8 ]
9 }

In Postman, this looks like:

/administration/$metadata - this endpoint returns the schema definition of the API itself,
in XML format; aka the API's OData EDMX. If you want to view it in an OpenAPI tool,
such as Swagger, you can convert it. We are not going to use it, but it is available as a
machine-readable API definition.

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 6/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

/administration/Namespaces(NamespaceID='sac')/Providers - This endpoint is


important. Providers is what SAC is calling models in this context. This endpoint returns a
json, listing all the models in the tenant, along with their names, descriptions and
provider IDs. This ProviderID is SAC's internal identifier for the model. Usually, this is a
long, generated hash. For certain SAP provided models, it is human readable. E.g. the
ProviderID for the Best Run Juice sample model is
sap.epm:BestRunJuice_SampleModel. Lastly, the json contains the service document
URL for each model. We’ll discuss the service document in the next section.

1 https://<tenant>.datacenter>.sapanalytics.cloud/api/v1/dataexport

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 7/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

Fetching the model metadata

There are two service URL endpoints, which return our model metadata

/providers/sac/<ProviderID>/

/providers/sac/<ProviderID>/$metadata

/providers/sac/<ProviderID>/ returns the service document. The service document is a


listing of the available service endpoints for this provider. These endpoints are:

The audit data

The model master data

The fact data

Each dimension’s master data

E.g. the URL for the Best Run Juice’s OData service document looks like:

1 https://<tenant>.datacenter>.sapanalytics.cloud/api/v1/dataexport

And the response json is:

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 8/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

1 {
2 "@odata.context": "$metadata",
3 "value": [
4 {
5 "name": "FactData",
6 "url": "FactData"
7 },
8 {
9 "name": "MasterData",
10 "url": "MasterData"
11 },
12 {
13 "name": "AuditData",
14 "url": "AuditData"
15 },
16 {
17 "name": "Account_BestRunJ_soldMaster",
18 "url": "Account_BestRunJ_soldMaster"
19 },
20 {
21 "name": "Store_3z2g5g06m4Master",
22 "url": "Store_3z2g5g06m4Master"
23 },
24 {
25 "name": "Location_4nm2e04531Master",
26 "url": "Location_4nm2e04531Master"
27 },
28 {
29 "name": "Product_3e315003anMaster",
30 "url": "Product_3e315003anMaster"
31 },
32 {
33 "name": "Sales_Manager__5w3m5d06b5Master",
34 "url": "Sales_Manager__5w3m5d06b5Master"
35 },
36 {
37 "name": "Date_703i1904sdMaster",
38 "url": "Date_703i1904sdMaster"
39 },
40 {
https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 9/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

41 "name": "Version_BestRunJsold_VMaster",
42 "url": "Version_BestRunJsold_VMaster"
43 }
44 ]
45 }

Generally, these provider specific endpoints all return their full (audit, dimension master
or fact) dataset by default. So the fact table endpoint would return the entire fact table,
dimension master data endpoints would return all master data values, etc. These
endpoints all support the typical OData parameters, such as $select, $filter, $orderby,
$pagesize and $skip, allowing you to shape the returned data json to your needs.

/providers/sac/<ProviderID>/AuditData – This endpoint returns a (maybe) small json,


which the number of entries in the audit log, and the audit log itself. If auditing has not
been enabled for the model, the endpoint still works; it just returns an empty audit log.

e.g. this model has not had auditing enabled:

1 https://<tenant>.datacenter>sapanalytics.cloud/api/v1/dataexport/

It still returns a valid json response, but you can see that the audit log (value) is empty:

1 {
2 "@odata.context": "https://<tenant>.<datacenter>.sapanalytics
3 "value": [],
4 "@des.entitiesInPage": "0",
5 "@des.processingTimeInMilliseconds": "1040"
6 }

/providers/sac/<ProviderID>/$metadata – This is an interesting endpoint, because it


returns the full OData EDMX API definition for that particular model. Sifting through this
juicy document, you can figure out what your measures are, account dimensions, date
dimensions, generic dimensions, etc. You might be inclined to use the service document

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 10/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

as a 10,000ft view of your model, because it is easy to read, but the EDMX document is
much more informative.

Fact Data

providers/sac/<ProviderID>/FactData – This is the model fact data, returned in json


format. As mentioned before, unless you filter it or page the returned results, it will be the
entire fact table* (at least until delta is available with QRC 2023.Q1).

If you wanted the entire fact table from the Best Run Juice sample model, you’d craft
your http call as such:

1 https://<tenant>.datacenter>.sapanalytics.cloud/api/v1/dataexport

But if you wanted only the Quantity Sold account and only fact data related to product ID
PD1, you can append OData filters:

1 https://<tenant>.datacenter>.sapanalytics.cloud/api/v1/dataexport

Dimension Master Data

/providers/sac/<model>/<dimensionID>Master – This endpoint returns a json with the


master data of the specified dimension. E.g. for a full enumeration of the X dimension, in
the Best Run Juice model, you’d craft the following URL:

1 https://<tenant>.datacenter>.sapanalytics.cloud/api/v1/dataexport

This concludes our tour of SAC’s data export API, as of January 2023. We have active
plans for expanding this API, so more endpoints and features will be added. Next time,
we’ll start building a Python wrapper.

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 11/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

Labels:

Technology Updates

Tags:

API APIs OData odatav4 SAP Analytics Cloud data export service

2 Comments

harelc
Discoverer

‎2023 May 24 4:07 PM

 0 Kudos

Hi

Thanks for the information!

What's the deal with 1 hour toekn lifetime???

Harel

thomasboub
Participant

‎2023 Nov 03 8:45 AM
https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 12/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

 0 Kudos

Thank you David! really insightful!

we are trying to filter Factdata with the url

1 https://<tenant>.datacenter>.sapanalytics.cloud/api/v1/dataexport

but we use a new model and we don't know how to filter a specific measure.

 You must be a registered user to add a comment. If you've already registered,


sign in. Otherwise, register and sign in.

Comment

Labels In This Area


ABAP CDS Views - CDC (Change Data Capture) 2 Advanced Event Mesh 1 AI 1

Analyze Workload Data 1 BS Reclassification 1 BTP 1

Business and IT Integration 2 Business application stu 1

Business Technology Platform 1 Business Trends 1,656 Business Trends​252

CAP 1 cf 1 Characteristics display 1 Classes 1 Cloud Foundry 1

Confluent 1 Customer COE Basics and Fundamentals 1

Customer COE Latest and Greatest 3 Customer Data Browser app 1

Data Analysis Tool 1 Data Migration 1 data transfer 1 Databricks 1

datasphere 2 Event Information 1,396 Event Information 192 events 1 Expert 1

Expert Insights 179 Expert Insights​850 General 2 Getting Started 2

Google cloud 1 Google Next'24 1 GraphQL 1 Introduction 1 Kafka 1

Life at SAP 779 Life at SAP​45 MDG materials 1 MDGM 1

Migrate your Data App 1 MLFlow 1 MTA 1 Network Performance Analysis 1

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 13/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

NodeJS 1 PDF 1 POC 1 Product Updates 4,560 Product Updates 942

Replication Flow 1 REST API 1 RisewithSAP 1 SAP BTP 1

SAP BTP Cloud Foundry 1 SAP Cloud ALM 1

SAP Cloud Application Programming Model 2 SAP Datasphere 2

SAP Datasphere ‫ تحقيق أقصى استفادة من بيانات األعمال‬1 SAP MDG Data Quality Management 1

SAP MDG DQM 1 SAP s4hana cloud 1 SAP S4HANA Migration Cockpit 1

Software Evolution 1 Technical article 1 Technology Updates 6,859

Technology Updates 1,149 Workload Fluctuations 1

Related Content
HANA Sizing Keypoints 
in Technology Blogs by Members yesterday

transport SAC data between prod and dev tenets 


in Technology Q&A Tuesday

Duplicate item on binding in SAPUI5 Application 


in Technology Q&A Tuesday

Custom file transfer for Homogeneous migration using parallel export/import 


in Technology Blogs by Members Monday

Datasphere THE solution to maintain the business context & considerations for
outbound data movement 
in Technology Blogs by SAP a week ago

Popular Blog Posts

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 14/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

Get Your SAP HANA Idea Incubator Badge Today!

Former Member

 41633  254  1283

SCN Mission - SAP HANA Quiz Challenge is now retired

ThomasJenewein
Product and Topic Expert

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 15/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

 42507  203  806

Share your #HANAStory and Win

christine_donato
Active Participant

 25533  60  451

Top Kudoed Authors

Raja_Gupta  20

thomas_weiss  8

KrishnaSharma7  8

akshatsaxena  7

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 16/17
1/7/25, 12:04 PM Data Export API: A tour of the API - SAP Community

nikita_tabakov  5

rashmi_vanaja  5

Harvey_Yao  4

yogananda  4

AndreaUS  4

AnanthNatarajan  4

View all

Privacy Terms of Use

Copyright Legal Disclosure

Trademark Support

Cookie Preferences
Follow

https://community.sap.com/t5/technology-blogs-by-sap/data-export-api-a-tour-of-the-api/ba-p/13567104 17/17

You might also like