Documents

Run a saved document query

Changed on

Runs one of the document's saved queries as it is saved and returns its results as a single JSON, CSV, or XLSX document. The query is read on the server: the caller can replace or add filters for the run, but cannot change anything else about what runs. A tile the document's dashboard shows, or any query of a document with an app, runs for anyone who can view the document, as on the dashboard or app itself; any other saved query, such as a hidden tile or a tab not on the dashboard, needs access to the workbook.

post/api/v1/documents/{identifier}/queries/{queryId}/run

Request

  • Base URL
    https://omniapp.co (the document declares no server; this is the origin it was published from)
  • URL
    https://omniapp.co/api/v1/documents/{identifier}/queries/{queryId}/run
  • Auth
    HTTP bearer

Path parameters

identifierstring required

Document identifier (either document ID or identifier slug)

Example:abc123
queryIdstring required

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

Example:1

Query parameters

userIdstring uuid

Target user ID (for org-scoped API keys)

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 with 400 rather than running without it.

formatResultsboolean

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

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

Format of the result document. Defaults to json.

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 (the default).

Changes

    • breaking

      removed subschema #6 subschema #7 subschema #8 subschema #9 subschema #10 subschema #11 subschema #12 subschema #13 from the / request property anyOf list

    • info

      added subschema #6 subschema #7 subschema #8 subschema #9 subschema #10 subschema #11 subschema #12 subschema #13 to the / request property anyOf list

    • info

      added the new optional request property