Trying to pull two dimension in a single API call | Community
Skip to main content
Level 2
Jul 20, 2023 9:09 PM UTC
Solved

Trying to pull two dimension in a single API call

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.
AritraBhAccepted solution
Level 2
Jul 21, 2023 4:51 PM UTC

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 ?

6 replies

Jennifer_Dungan
Level 2
Jul 20, 2023 11:16 PM UTC

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.

Translate
AritraBhAuthor
Level 2
Jul 21, 2023 4:17 PM UTC

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

Translate
Jennifer_Dungan
Level 2
Jul 21, 2023 4:28 PM UTC

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

Translate