Expand my Community achievements bar.

Join us January 15th for an AMA with Champion Achaia Walton, who will be talking about her article on Event-Based Reporting and Measuring Content Groups!
SOLVED

Trying to pull two dimension in a single API call

Avatar

Level 2

I am new to Adobe Analytics API. I am trying to create a pipeline to extract data from adobe API. 

I have two dimension which I need to pull , For example : 

evar1 and evar2 in a single API call. I was reading through the documentation but was not able to progress through it. 

 

My request body looks something like this : I am trying to bring in evar1 along with evar2 in this single API call. 

 

body = {
'rsid': 'rsid',
'globalFilters': [{
'type': 'dateRange',
'dateRange': '2023-07-01T00:00:00/2023-07-16T23:59:59.999'
},
{
'type': 'segment',
'segmentId': 'sgid'
}],
'metricContainer': {
'metrics': [
{'id': 'metrics/occurrences'},
]}
,
'dimension': 'variables/evar1',
'settings': {
'dimensionSort': 'asc',
'limit':'100000'
}
}

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

how would I create a body for data warehouse exports? As in if I am writing my code in python , is there a way to connect to the data warehouse and fetch data ?

View solution in original post

6 Replies

Avatar

Community Advisor and Adobe Champion

A little known fact is that Workspace is built using API 2.0; and you can actually get the API calls that are used right from the Workspace.

 

First, you need to enable debug mode:

Jennifer_Dungan_0-1689894846956.png

 

This will add a new Icon to your tables:

Jennifer_Dungan_1-1689894863649.png



When you click on the icon, you will get the option for the Sparkline or the Table, choose the table:

Jennifer_Dungan_2-1689894894215.png

 

 

Now, you will be presented with Timestamps.. more complex tables may use multiple API calls:

Jennifer_Dungan_3-1689894927435.png

 

 

When you click on each time, a new page will open showing you the API used in multiple formats including JSON and Curl, etc.

 

This might be a better starting point than trying to write the API from scratch.

Avatar

Level 2

Thank you for your response. But this freeform table is also not allowing me to pull more than one dimension . may be I am missing something here.

 

This is the body I got using the debugger : 

 

body={
"rsid": "myrsid",
"globalFilters": [
{
"type": "dateRange",
"dateRange": "2023-07-01T00:00:00.000/2023-08-01T00:00:00.000",
"dateRangeId": "thisMonth"
}
],
"metricContainer": {
"metrics": [
{
"columnId": "0",
"id": "metrics/occurrences",
"sort": "desc",
"filters": [
"0"
]
}
],
"metricFilters": [
{
"id": "0",
"type": "breakdown",
"dimension": "variables/evar4",
"itemId": "2254528984"
}
]
},
"dimension": "variables/evar79",
"settings": {
"countRepeatInstances":True,
"includeAnnotations":True,
"limit": 10,
"page": 0,
"nonesBehavior": "return-nones"
}
}

Avatar

Community Advisor and Adobe Champion

Can you share what you are doing? If you are trying to pull multiple dimensions you can only do so as a Breakdown... not a flat table.

 

I.e.
                                          metric X

eVar1 - value 1                  ###

          eVar2 - value 1        ##

          eVar2 - value 2        ##

eVar1 - value 2                  ###

          eVar2 - value 1        ##

          eVar2 - value 2        ##

 

If you need a flat table, you should consider using the Data Warehouse exports.

 

eVar 1 - Value 1   |    eVar 2 - Value 1    |      ###

eVar 1 - Value 1   |    eVar 2 - Value 2    |      ###

eVar 1 - Value 2   |    eVar 2 - Value 1    |      ###

eVar 1 - Value 2   |    eVar 2 - Value 2    |      ###

Avatar

Correct answer by
Level 2

how would I create a body for data warehouse exports? As in if I am writing my code in python , is there a way to connect to the data warehouse and fetch data ?

Avatar

Level 2

The first option is something I am looking for. But my response does not show the breakdown values. Is there something wrong with the body that I posted ? 

 

Also, Is there a way to connect to the data warehouse and get the values using a wrapper script. I am trying to automate this activity in python .

Avatar

Community Advisor and Adobe Champion

So you want the breakdown data? You shouldn't have any issues creating this breakdown in Workspace...

 

Now, workspace does need each item to be broken down, but when you get the API code, you should be able to apply that breakdown the same way for all rows...

 

I don't have any active APIs so I can't really look into a sample of how this is done.. I can only really help on the surface level here....

 

 

Now, for Data Warehouse, you would need to schedule the data warehouse exports to go to an FTP folder, then you would have to use Python to pull the CSV file from the FTP to process it.

 

https://experienceleague.adobe.com/docs/analytics/export/data-warehouse/data-warehouse.html?lang=en