Newer Version Available
Run Reports Synchronously or Asynchronously
Get summary data with or without details by running a report synchronously or asynchronously through the API. When you run a report, the API returns data for the same number of records that are available when the report is run in the Salesforce user interface.
Run a report synchronously if you expect it to finish running quickly. Otherwise, we recommend that you run reports through the API asynchronously for these reasons:
-
Long running reports have a lower risk of reaching the timeout limit when run asynchronously.
-
The 2-minute overall Salesforce API timeout limit doesn’t apply to asynchronous runs.
-
The Salesforce Reports and Dashboards REST API can handle a higher number of asynchronous run requests at a time.
-
Since the results of an asynchronously run report are stored for a 24-hr rolling period, they’re available for recurring access.
To run a report synchronously:
- Send a GET or POST request to the Execute Sync resource to get data.
-
Use a POST request to get specific results on the fly by passing dynamic filters, groupings, and aggregates in the report metadata.
To fetch report data asynchronously:
-
Send a POST request to the Execute Async resource. If you’re passing filters, include them in the POST request metadata. The request returns the instance ID where results of the run are stored.
-
Send a GET request to the Instance Results resource to fetch data using the instance ID.
Example of a synchronous report run
This GET request to the Execute Sync resource, /services/data/v35.0/analytics/reports/00OR0000000K2UeMAK?includeDetails=true, for a synchronous run returns summary data with details.
Example of an asynchronous report run
- This is a POST request (an empty request body), /services/data/v35.0/analytics/reports/00OR0000000K2UeMAK/instances, to the
Execute Async resource for an asynchronous run requesting summary
results.
The response to the POST request returns the instance handle that stores the summary results of the run.
- A GET request, /services/data/v35.0/analytics/reports/00OR0000000K2UeMAK/instances/0LGR00000000He3OAE,
to the Instance Results resource for the instance handle fetches the report
results.