From 93b371031c0097c4028cf621f4b8257e3cc6b217 Mon Sep 17 00:00:00 2001 From: Giordano Ricci Date: Tue, 25 Jul 2023 10:29:53 +0100 Subject: [PATCH] Explore: add URL schema docs (#71724) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kristina Co-authored-by: Piotr Jamróz Co-authored-by: Kim Nylander <104772500+knylander-grafana@users.noreply.github.com> --- docs/sources/explore/_index.md | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docs/sources/explore/_index.md b/docs/sources/explore/_index.md index 4d2efad9874..f8c40982072 100644 --- a/docs/sources/explore/_index.md +++ b/docs/sources/explore/_index.md @@ -64,6 +64,46 @@ In split view, timepickers for both panels can be linked (if you change one, the To close the newly created query, click on the Close Split button. +## Share Explore URLs + +When using Explore, the URL in the browser address bar updates as you make changes to the queries. You can share or bookmark this URL. + +### Generating Explore URLs from external tools + +Because Explore URLs have a defined structure, you can build a URL from external tools and open it in Grafana. The URL structure is: + +``` +http:///explore?panes=&schemaVersion=&orgId= +``` + +where: + +- `org_id` is the organization ID +- `schema_version` is the schema version (should be set to the latest version which is `1`) +- `panes` is a url-encoded JSON object of panes, where each key is the pane ID and each value is an object matching the following schema: + +``` +{ + datasource: string; // the pane's root datasource UID, or `-- Mixed --` for mixed datasources + queries: { + refId: string; // an alphanumeric identifier for this query, must be unique within the pane, i.e. "A", "B", "C", etc. + datasource: { + uid: string; // the query's datasource UID ie: "AD7864H6422" + type: string; // the query's datasource type-id, i.e: "loki" + } + // ... any other datasource-specific query parameters + }[]; // array of queries for this pane + range: { + from: string | number; // the start time, in milliseconds since epoch + to: string | number; // the end time, in milliseconds since epoch + } +} +``` + +{{% admonition type="note" %}} +The `from` and `to` also accept relative ranges defined in [Time units and relative ranges]({{< relref "../dashboards/use-dashboards/#time-units-and-relative-ranges" >}}). +{{% /admonition %}} + ## Share shortened link {{% admonition type="note" %}}