Often, you may want to run the same report repeatedly but don’t want to maintain the full configuration in your code. By pulling the saved configuration from ObservePoint, you can keep your scripts lean, minimize maintenance, and ensure consistency with what’s defined in the UI.
This is especially useful when:
- You have multiple reports managed by different teams.
- You want to automate report execution without hardcoding parameters.
- You want to ensure your automation stays in sync with changes made in the ObservePoint interface.
This example shows how to use the Grid API to:
- Retrieve the configuration of a saved report in ObservePoint using its report ID.
- Execute that report dynamically by sending the retrieved configuration (
queryDefinition) to the correct Grid API endpoint.
This approach removes the need to hardcode configurations in your scripts. Instead, you can manage configurations directly in ObservePoint and collect data from those reports programmatically.
For reference:
To retrieve a specific report configuration, you first need its report ID.
Navigate to the desired report in ObservePoint.
In the browser URL, you will see something like:
https://app.observepoint.com/reports/12345The digits at the end (12345) are the report ID.
Make a GET request to retrieve the saved report:
GET https://api.observepoint.com/v3/reports/grid/saved/12345{
"id": 12345,
"name": "Top Pages by Load Time",
"gridEntityType": "web_audit_runs",
"queryDefinition": {
"columns": [...],
"filters": {...},
"sortBy": [...],
"page": 0,
"size": 100
}
}Take the gridEntityType value from the response (e.g., "web_audit_runs") and use it to determine the final segment of the Grid API URL. Note that the actual endpoint uses hyphens instead of underscores (e.g., web-audit-runs). You can also reference the Grid API Entities table to confirm the correct format for the endpoint. For the example "web_audit_runs", the endpoint is:
POST https://api.observepoint.com/v3/reports/grid/web-audit-runsYou have two options for retrieving data from the saved report configuration.
Make a POST request to the matching endpoint, using the queryDefinition from the saved report response as the request body. You will need to paginate to retrieve all rows by incrementing the page parameter until no additional data is returned. See Grid API Pagination for details.
curl -X POST "https://api.observepoint.com/v3/reports/grid/web-audit-runs" \
-H "Authorization: api_key API_TOKEN" \
-H "Content-Type: application/json" \
--data-raw '{
"size": 100,
"page": 0,
"filters": { ... },
"columns": [ ... ],
"sortBy": [ ... ]
}'This will return data in JSON format, where each row corresponds to a record in the report.
To retrieve the saved report data as a downloadable file, use the export process described in Grid API Exports.
This method lets you export the saved report in a single call and retrieve the results as a file in one of the supported formats:
- TSV (Tab-separated values)
- CSV (Comma-separated values)
- XLSX (Excel)
- Parquet (Apache Parquet)
Include the queryDefinition from the saved report response as the request body, and add a fileFormat attribute to specify your desired output format (e.g., "csv", "tsv", "xlsx", or "parquet").
Refer to the Grid API Exports documentation for detailed request examples and additional support.