Skip to content

Reference

Draft panel preview

The draft panel preview endpoints of the HTTP API.

POST /datasources/{uid}/preview

Run an unsaved data panel placed into a saved dashboard version and return its frames.

The draft replaces the panel panel_id of the given version, the result is validated as a whole like a save (the draft must keep the id panel_id, and its datasource and every query’s must be or resolve to the datasource in the path), and the draft’s queries run with the agent tools’ limits (15 seconds, 200 series, 100,000 points, 1,000 rows). Only signed-in users may call it: a service-account key gets 403 user_session_required and uses query_range instead. Nothing is cached, and the call counts against the caller’s 8 in-flight query requests. from, to, tz, max_data_points and variables behave as the parameters of panel data: from and to default to the version’s time, max_data_points defaults to 1000 and is capped by the draft’s maxDataPoints, and each variable lists its selected values, with $__all selecting All; a variable that is not given gets its default. Every query runs as a range query unless it sets instant or the panel is a table or logs panel. A panel’s timeFrom replaces the range with the last N units up to now, and timeShift moves the range back; meta.from and meta.to report the range that ran. The response has the shape of panel data, with meta.cached always false.

Parameters

Name In Type Description
uid (required) path string

Request body

application/json, required.

Field Type Description
dashboard_id (required) string (uuid)
version (required) integer Between 1 and 2147483647.
panel_id (required) string
panel (required) object The draft panel, in the Spec’s panel shape.
from string
to string
tz string The browser’s IANA time zone, used as for panel data when the dashboard’s timezone is browser.
max_data_points integer Between 10 and 11000. Default 1000.
variables object

Responses

Status Description Body
200 The frames the draft’s queries returned. PanelData
400 The request is malformed or fails validation, the draft is not a data panel, or its id does not match the request, or its datasource or any query’s datasource is not the one in the path. PanelDataError
401 Authentication is missing or invalid. Error
403 The caller is not a signed-in user (user_session_required), or cannot change the dashboard (forbidden_role). Error
404 The datasource, dashboard or version does not exist (not_found), or the version has no panel panel_id (panel_not_found). PanelDataError
413 The request body exceeds the size limit. Error
422 The draft fails Spec validation (invalid_spec with issues), or one of its queries or variables cannot run: query_invalid, query_forbidden, limit_exceeded (also for a response over 32 MiB), unknown_datasource, variable_failed, variable_empty or expression_error (an expression query failed or one of its inputs did), with the failing query’s ref when one query failed. ValidationError or PanelDataError
429 The caller already has the maximum number of query requests in flight, or the server’s shared upstream call slots stayed busy for 5 seconds. Error
500 The server failed to handle the request, including a datasource call that failed without a classified cause. PanelDataError
502 A datasource is unavailable. PanelDataError
504 A datasource did not answer within the draft’s 15 second query timeout, or the request did not finish within 20 seconds; ref names the failing query when one query timed out. PanelDataError

Generated from api/openapi.yaml at bac0fe39. Report a problem.

/observeOpen source under Apache-2.0.Grafana is a trademark of Grafana Labs. SlashObserve is not affiliated with or endorsed by Grafana Labs.

Search pages and headings.