Documents

Run a saved document query

Changed on

Run one of a document's saved queries and returns the results as JSON, CSV, or XLSX. Only adding and updating existing filters is supported. To modify more than a query's filters before running it, see the Running document queries with APIs guide.

View access is required to run queries that are shown as tiles on a dashboard, or any saved query on a document with an app. All other saved queries require access to the document's workbook.

This API is the only way to run a dashboard tile for a user with read-only access to a dashboard. To run a query definition you supply yourself, use the Run query API instead.

post/v1/documents/{documentId}/queries/{queryId}/run

Request

  • Base URL
    https://blobsrus.omniapp.co/api
  • URL
    https://blobsrus.omniapp.co/api/v1/documents/{documentId}/queries/{queryId}/run
  • Auth
    HTTP bearer

Path parameters

documentIdstring required

Document identifier (either document ID or identifier slug)

queryIdstring required

The saved query to run: its queryIdentifierMapKey, or its query presentation id, from GET /v1/documents/{documentId}/queries.

Query parameters

userIdstring uuid

Organization API key required. The membership ID of the user to act as.

Request body

filtersobject

Filters to apply for this run, keyed by field name (e.g. orders.status). Each replaces the saved filter on the same field and the saved query is not modified. A filter that cannot be applied fails the request.

formatResultsboolean

Whether to format result values (e.g., apply number formatting).

resultType'csv' | 'xlsx' | 'json'

Format of the result document. For csv and xlsx results formats, the document's Download setting must be enabled.

Example request

{
  "filters": {
    "chargers.id": "CH-1042"
  },
  "resultType": "json"
}

Response

The saved query ran; the body is its result document.

object[] required

Result rows keyed by field name. Returned when resultType is json.

Changes