Skip to content
Last updated

Example: Gather Data from Saved Report Configuration

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:

  1. Retrieve the configuration of a saved report in ObservePoint using its report ID.
  2. 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:


Step 1: Get the Desired Report ID

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:

Example Report URL
https://app.observepoint.com/reports/12345

The digits at the end (12345) are the report ID.


Step 2: Retrieve Saved Report Configuration

Make a GET request to retrieve the saved report:

Request to Retrieve Saved Report
GET https://api.observepoint.com/v3/reports/grid/saved/12345
Example Saved Report Response
{
  "id": 12345,
  "name": "Top Pages by Load Time",
  "gridEntityType": "web_audit_runs",
  "queryDefinition": {
    "columns": [...],
    "filters": {...},
    "sortBy": [...],
    "page": 0,
    "size": 100
  }
}

Step 3: Identify the Correct Grid API Endpoint

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:

Example Grid API Endpoint
POST https://api.observepoint.com/v3/reports/grid/web-audit-runs

Step 4: Collect the Report Data

Make a POST request to the matching endpoint, using the queryDefinition from the saved report response as the request body.

Request to Execute Saved Report
POST https://api.observepoint.com/v3/reports/grid/web-audit-runs
Content-Type: application/json

{
  "size": 10,
  "page": 0,
  "filters": {...},
  "columns": [
    {...}
  ],
  "sortBy": [
    {...}
  ]
}

Example Response JSON

The response format will match the documented response for that entity type, for example:

Example Grid API Response
{
  "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...
  ]
}