Some clients want to generate reports automatically. The entire process is detailed in this article: Advanced Reporting API Walkthrough.
I’ve noticed that sometimes Customers encounter issues with the step of checking if a report is ready to be downloaded. The Get Report Status endpoint is: {{baseURL}}/reportsquery/api/Report/{{reportId}}/status.
The issues they face often result in an unauthorized error caused by the following factors:
Report Generation Time: Generating the report can take longer than 15 minutes (the default bearer token lifetime). The client must ensure they are refreshing the bearer token every 15 minutes.
Timeout: The report generation exceeded the 60-minute timeout, indicating the query needs to be optimized.
User Access: If the report is generated by user A and the status is checked by another user B who doesn’t have access, an error occurs. Clients must ensure they use the same user to verify if the report is ready to be downloaded.
Clients should consider these points when automating report generation using direct calls to the Reporting API.