Get a saved analytics dashboard's data

GET https://api.suger.cloud/ai/org/{orgId}/analytics/dashboard/{dashboardId}/data

Runs the query of each chart block of a dashboard under a viewer's state, read with the caller's own permissions, and returns each block's result in reading order with what each filter did to it. The viewer's state is in the query string, as the dashboard's page writes it: each filter by its id (`time=last-6-month`, `status=ACTIVE&status=PENDING`, `amount=100..500`, `!off` to turn a default off, `!null` for (none)), a cross-filter as `x.<block>.<output>=<value>`, and a drill as `d.<block>.<output>=<value>` with `by.<block>=<field>`. A filter the query string leaves out takes its saved default. A value a filter cannot take is refused with INVALID_REQUEST, naming the filter. `_version` names the version of the dashboard the page drew: one saved at another version since is refused with VERSION_CONFLICT before anything is read, its block, filter or state included. Without it, the latest version is read. A chart that cannot be read, such as one over a dataset the caller may not read (DATASET_FORBIDDEN) or one a filter breaks (QUERY_REJECTED, with the filter `refused`), carries its own error, and the others still load. An answer holds 8 MiB of results at most: each chart past that carries BUSY and was not read, and GetAnalyticsDashboardBlockData reads it on its own.

Parameters

NameInTypeRequiredDescription
orgId path string yes Organization ID
dashboardId path string yes
_version query integer no The version of the dashboard the page reading it drew, as GetAnalyticsDashboard answered it: a dashboard saved at another version since is refused with VERSION_CONFLICT, naming the version it is at, and nothing is read. Without one, the latest version is read.

Responses

200 — Each chart block's result or error

Content-Type: application/json · Schema: AnalyticsDashboardData

AnalyticsDashboardData fields:

FieldTypeRequiredDescription
blocks array<AnalyticsDashboardBlockData> yes

401 — No valid token

Content-Type: application/json · Schema: AiErrorResponse

AiErrorResponse fields:

FieldTypeRequiredDescription
error string yes Error message

403 — Not a member of the organization

Content-Type: application/json · Schema: AiErrorResponse

AiErrorResponse fields:

FieldTypeRequiredDescription
error string yes Error message

404 — NOT_FOUND

Content-Type: application/json · Schema: AnalyticsError

AnalyticsError fields:

FieldTypeRequiredDescription
error object yes

409 — VERSION_CONFLICT: the read names a version the dashboard was saved past; nothing is read

Content-Type: application/json · Schema: AnalyticsError

AnalyticsError fields:

FieldTypeRequiredDescription
error object yes

422 — INVALID_REQUEST: a value of the state cannot be read

Content-Type: application/json · Schema: AnalyticsError

AnalyticsError fields:

FieldTypeRequiredDescription
error object yes

429 — BUSY: too many analytics reads are running

Content-Type: application/json · Schema: AnalyticsError

AnalyticsError fields:

FieldTypeRequiredDescription
error object yes

500 — ANALYTICS_UNAVAILABLE: an unexpected failure

Content-Type: application/json · Schema: AnalyticsError

AnalyticsError fields:

FieldTypeRequiredDescription
error object yes

503 — ANALYTICS_UNAVAILABLE: analytics is not configured or not ready

Content-Type: application/json · Schema: AnalyticsError

AnalyticsError fields:

FieldTypeRequiredDescription
error object yes

Example

Generated from this operation's schema. Values are placeholders — substitute your own ids, and set SUGER_TOKEN to a bearer token from the OAuth client-credentials exchange.

Request

curl -X GET 'https://api.suger.cloud/ai/org/{orgId}/analytics/dashboard/{dashboardId}/data' \
  -H "Authorization: Bearer $SUGER_TOKEN"

Response — 200

{
  "blocks": [
    {
      "block": "string",
      "applied": {},
      "chart": {},
      "result": {
        "schema": {
          "kind": "aggregate",
          "columns": [],
          "limit": 1,
          "order": []
        },
        "rows": [
          {}
        ],
        "meta": {
          "dataVersion": "string",
          "asOf": "string",
          "truncated": true,
          "range": {},
          "unbounded": true,
          "fxAsOf": "string",
          "fxMissing": []
        },
        "page": {
          "next": "string"
        }
      },
      "drillLabel": "string",
      "drillOutputLabel": "string",
      "noRowsYet": true,
      "detailRefused": "string",
      "tileDetailRefused": "string"
    }
  ]
}

Error — 401

{
  "error": "string"
}

View as Markdown · API reference overview

Spotted something wrong or out of date on this page? Tell us and we'll correct it.