Get One Chart Block's Data

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

Runs one chart block's query under a viewer's state, as GetAnalyticsDashboardData does for every block: a page loads each tile this way. 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.

Parameters

NameInTypeRequiredDescription
orgId path string yes Organization ID
dashboardId path string yes
blockId 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 — The block's result or error

Content-Type: application/json · Schema: AnalyticsDashboardBlockData

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: no dashboard, or no chart block with this id

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

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}/blocks/{blockId}/data' \
  -H "Authorization: Bearer $SUGER_TOKEN"

Response — 200

{
  "block": "string",
  "applied": {},
  "chart": {},
  "result": {
    "schema": {
      "kind": "aggregate",
      "columns": [
        {
          "name": "Acme Corp",
          "role": "dimension",
          "label": "string",
          "type": {},
          "nullable": true,
          "approximate": true,
          "additive": true,
          "time": {},
          "change": {},
          "bin": {}
        }
      ],
      "limit": 1,
      "order": [
        {
          "by": "string",
          "dir": "asc"
        }
      ]
    },
    "rows": [
      {}
    ],
    "meta": {
      "dataVersion": "string",
      "asOf": "string",
      "truncated": true,
      "range": {
        "from": "string",
        "to": "string"
      },
      "unbounded": true,
      "fxAsOf": "string",
      "fxMissing": [
        "string"
      ]
    },
    "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.