Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Problem with same ItemIDs passed in Python code

kkrishna_hyd
Level 1
Level 1

Hello

 

I am writing a Python code to extract data from Adobe Analytics via the standard API calls. My requirement is to extract data like impressions, clicks, page views etc., broken by few dimensions. 

 

When I pass the metrics in the metricContainer however I am getting this error: 

 

{"errorCode":"invalid_data","errorDescription":"Request contained multiple filters with id=0","errorId":"a072dedc-120c-45b7-8d94-5e4f9c20900a"}

 

I know the error but I don't know how to handle this. If I cannot have multiple filters with same ID value of "zero" how can I handle such situations?

 

Please help 😞 😞 😞

 

4 Replies
amgup
Level 7
Level 7

@kkrishna_hyd  Before executing the API in Python I will suggest you try it in Swagger API so that you can manipulate the requests easily and get the desired result.

https://adobedocs.github.io/analytics-2.0-apis/

From the error you are getting it seems like you are using multiple filters in metrics container for a particular metric id object. I will suggest to try in the above link and modify the request accordingly. If not solved than provide a sample request body which you sending to the endpoint.

kkrishna_hyd
Level 1
Level 1

Hello. I tried in Swagger UI earlier but I thought this complete code may not be suitable to run in the entire Swagger UI. Please find below the request body. 

 

body1_ind4 = {
'rsid': client,
'globalFilters': [{'type': 'dateRange', 'dateRange': date_str}],
'metricContainer': {
'metrics': [{"id": "metrics/visits", "filters": [il1, il2, il3]},
{"id": "metrics/pageviews", "filters": [il1, il2, il3]},
{"id": "metrics/revenue", "filters": [il1, il2, il3]},
{"id": "metrics/event42", "filters": [il1, il2, il3]},
{"id": "metrics/itemtimespent", "filters": [il1, il2, il3]},
{"id": "metrics/units", "filters": [il1, il2, il3]},
{"id": "metrics/orders", "filters": [il1, il2, il3]},
{"id": "metrics/event6", "filters": [il1, il2, il3]},
{"id": "metrics/visitors", "filters": [il1, il2, il3]}],
"metricFilters": [
{"id": il2, "type": "breakdown", "dimension": "variables/searchenginenatural","itemId": il2},
{"id": il3, "type": "breakdown", "dimension": "variables/campaign","itemId": il3},
{"id": il1, "type": "breakdown", "dimension": "variables/daterangeday","itemId": il1}
]},
'dimension': 'variables/referringdomain',
"settings": {"dimensionSort": "asc","countRepeatInstances": False}
}

I believe if the values of il2 and il3 are same and equal to zero the error throws out. I am not sure why two itemIds can have the same values in Adobe Analytics. 😞

 

Regards

 

Krishna

kkrishna_hyd
Level 1
Level 1

Hello. I tried in Swagger UI earlier but I thought this complete code may not be suitable to run in the entire Swagger UI. Please find below the request body. 

 

body1_ind4 = {
'rsid': client,
'globalFilters': [{'type': 'dateRange', 'dateRange': date_str}],
'metricContainer': {
'metrics': [{"id": "metrics/visits", "filters": [il1, il2, il3]},
{"id": "metrics/pageviews", "filters": [il1, il2, il3]},
{"id": "metrics/revenue", "filters": [il1, il2, il3]},
{"id": "metrics/event42", "filters": [il1, il2, il3]},
{"id": "metrics/itemtimespent", "filters": [il1, il2, il3]},
{"id": "metrics/units", "filters": [il1, il2, il3]},
{"id": "metrics/orders", "filters": [il1, il2, il3]},
{"id": "metrics/event6", "filters": [il1, il2, il3]},
{"id": "metrics/visitors", "filters": [il1, il2, il3]}],
"metric Filters": [
{"id": il2, "type": "breakdown", "dimension": "variables/searchenginenatural","itemId": il2},
{"id": il3, "type": "breakdown", "dimension": "variables/campaign","itemId": il3},
{"id": il1, "type": "breakdown", "dimension": "variables/daterangeday","itemId": il1}
]},
'dimension': 'variables/referringdomain',
"settings": {"dimensionSort": "asc","countRepeatInstances": False}
}

I believe if the values of il2 and il3 are same and equal to zero the error throws out. I am not sure why two itemIds can have the same values in Adobe Analytics. 😞

 

Regards

 

Krishna

khurshid
Level 2
Level 2

I would suggest running the desired report in Adobe Analytics Workspace, open Workspace Debugger, copy the curl request and convert it to Python code (using Postman).