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/12345
The 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-runs
Make a POST
request to the matching endpoint, using the queryDefinition
from the saved report response as the request body.
POST https://api.observepoint.com/v3/reports/grid/web-audit-runs
Content-Type: application/json
{
"size": 10,
"page": 0,
"filters": {...},
"columns": [
{...}
],
"sortBy": [
{...}
]
}
The response format will match the documented response for that entity type, for example:
{
"metadata": {
"pagination": {
"totalCount": 500,
"totalPageCount": 5,
"pageSize": 100,
"currentPageSize": 100,
"currentPageNumber": 0
}
},
"rows": [
["https://example.com/page1", 1234, 2.5],
["https://example.com/page2", 4567, 2.3]
// more rows...
]
}