Explore: add URL schema docs (#71724)

Co-authored-by: Kristina <kristina.durivage@grafana.com>
Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
Co-authored-by: Kim Nylander <104772500+knylander-grafana@users.noreply.github.com>
This commit is contained in:
Giordano Ricci 2023-07-25 10:29:53 +01:00 committed by GitHub
parent 2bc1b5b1e1
commit 93b371031c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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://<grafana_url>/explore?panes=<panes>&schemaVersion=<schema_version>&orgId=<org_id>
```
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" %}}