Get the Analytics Query Grammar

GET https://api.suger.cloud/ai/org/{orgId}/analytics/grammar

Gets the grammar of an analytics query, as types with a line for each part and each op, and worked example queries over the datasets the caller can query. Write a query in it, naming only what GetAnalyticsDataset lists, and check it with DescribeAnalyticsQuery before running it.

Parameters

NameInTypeRequiredDescription
orgId path string yes Organization ID

Responses

200 — The grammar

Content-Type: application/json · Schema: AnalyticsQueryGrammar

AnalyticsQueryGrammar fields:

FieldTypeRequiredDescription
grammar string yes The grammar of a query, as types: a line for the query, each part it names and each op, with what each means.
examples array<object> 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

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/grammar' \
  -H "Authorization: Bearer $SUGER_TOKEN"

Response — 200

{
  "grammar": "string",
  "examples": [
    {
      "description": "string",
      "query": {}
    }
  ]
}

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.