Trying to pull two dimension in a single API call | Community
Skip to main content
Level 2
July 20, 2023
Solved

Trying to pull two dimension in a single API call

  • July 20, 2023
  • 1 reply
  • 2126 views

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'
}
}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AritraBh

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    |      ###


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 ?

1 reply

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 20, 2023

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:

 

This will add a new Icon to your tables:



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

 

 

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

 

 

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.

AritraBhAuthor
Level 2
July 21, 2023

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"
}
}

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 21, 2023

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    |      ###