Adobe Analytics API 1.4

Adobe Analytics API : getReport

The method getReport is the heart of the Adobe Analytics API for python. This is most of the time the reason why you would like to use this API. This method is the one that will return the data of your statement, we are going to see what kind of argument is possible to pass and what to expect in return.

This post will go directly to the core of the functionality of this function.
There is no reason to explain, why this method has been created or what it exactly does.

getReport method for Adobe Analytics API

The getReport method takes 1 required argument and several options.
Argument :

  • statement : REQUIRED : this could be an object that contains your dictionary / JSON statement or a txt file that contains your statement.
  • export : OPTIONNAL : boolean to determine if a csv file is going to be created in a folder,aanalytics, that is created automatically in the location where you run your python program. (default : True)
  • return_data : OPTIONNAL : boolean to determine if a dataframe is returned from the statement (default : True)
  • recursive : OPTIONNAL : for non DW reports, there is a limitation of the number of row you can return from the Adobe Analytics API. The maximum you can retrieve is 50K. By setting this parameter to True, you automatically retrieve 50K rows for the first element of your statement, then the script determine if another statement is necessary until there is no more rows to fetch. (default : False)
  • verbose : OPTIONNAL : print comments if you want to follow the status of the request (default : False)
  • safe_mode : OPTIONNAL : save the report ID created into a file “save_report_id.txt” located in your folder where you run your script. (default : False)

As usual you can always use the help function to review these explanation in your python console :


Example of getReport use :

#with a dictionary as statement
df = aanalytics.getReport(my_statement)
#with the Statement class usage
df = aanalytics.getReport(my_statement.statement)

#with a file (I recommend to place the file in the same folder than your python program)
df = aanalytics.getReport("my_statement.txt")

#if you want to use a file that is placed in another folder, 
#I would recommend to use the "r" parameter to say that it is a raw string
df = aanalytics.getReport(r"C:\Users\username\Documents\myPythonFolder\my_statement.txt")

I hope those explanation would be enough for you to start using this API with python.
In case of question or remark, feel free to leave a comment or contact me, using the the contact page.

On this series, you may want to read as well :

Leave a Reply

Your email address will not be published. Required fields are marked *