Query Metric
POST/v1/datasets/metrics/query
Compute a metric from its stored definition, on the rows you may read.
The server compiles the definition (its expression, its default filters,
your time range, grain, dimensions and filters) into one SELECT over the
metric's dataset and runs it through the same lane as POST /v1/query, as
you: your row rules, your group's and your key's bindings apply, and the read
is recorded on your credential. Two members with different row rules get two
different, correct numbers.
metricis a name fromlist_metrics;datasetIdis needed only when two datasets you can view define that name (409metric_ambiguousnames them).versionpins the definition: when the metric has moved on, the call is refused (409metric_version_changed, with the current version) instead of answering with a definition you did not mean.grain(day,week,month,quarter,year) needs a time column;timeRange.startis inclusive andtimeRange.endexclusive.dimensionsandfiltersname DECLARED dimensions only; filter values are bound as literals. At most 10,000 result rows.
Returns value (no grain and no dimensions) or columns + rows, the
definition used (metric: name, label, definition, expr, filters, status,
version, caveats), rowScope, rowPolicyApplies, freshness (asOf,
provisionalFrom from the dataset's declared lateness) and the compiled
sql. Refusals of the query lane answer exactly as POST /v1/query does.
Request
Responses
- 200
- 404
- 422
Successful Response
Not found
Validation Error