On this post, I will explain the last method available with this API, the retrieveReport method.
This method is the last one to be explained because it depends on the others. It works only with the report id that has been created after you send a statement to the Adobe Analytics endpoint.
The report id value are valid for 72 hours after the report creation. It means that you have 3 days to retrieve a report created by the Adobe Analytics API. After that, the report id is just not valid anymore and will return an error.
The retrieveReport method
This method takes 2 arguments but only 1 is required when using it.
When you have creating a report using the getReport method, explained previously, you could use a specific parameter that is : safe_mode.
If you set that parameter to True, it will automatically create a file (save_report_id.txt) in your working folder and there you will have 2 information :
- the report id : usually a number
- the request_type : it is describing what type of report you are requesting
- json for normal report
- csv for datawarehouse report
The output of the python API is always a csv but the output of the Analytics API itself vary. So we need to know what to expect as type of file.
Using those 2 information you can request the report using the method retrieveReport :
Example : my_report = aanalytics.retrieveReport(report_id=11111,request_type=’json’,export=True,return_data=True,verbose=False)
As you could see, the retrieveReport is using some additional parameter that already exist for the getReport :
- export : OPTIONNAL : boolean to determine if a csv file has to be created (default : True)
- return_data : OPTIONNAL : boolean to determine if a dataframe is returned (default : True)
- verbose : OPTIONNAL : print comments if you want to follow the status of the request (default : False)
- If you don’t specific a request_type, the python API assume that you want to retrieve a normal report (json)
- You cannot retrieve unlimited rows for normal report using the retrieveReport function (50K rows limitation apply here). You would need to re-run a getReport function with the parameter recursive set to True for that.
On this series, you may want to read as well :
|Introduction||What is to know about the Adobe Analytics API with Python|
|Requirements||What is necessary to know and to be done before you start with the aanalytics module|
|Statement creation||What is a statement and why is it import for the API|
|Statement Class||What is a the statement Class and how can it help you created a statement|
|Getelements method||Explanation on how the getElements method works|
|Getelements method||Explanation on how the getReport method works|
|Getelements method||Explanation on how the retrieveReport method works|