mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 14:12:09 +08:00

* Set every page to have defaults of 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration pages to have of 'Cloud', 'Enterprise', and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/enterprise-licensing pages to have 'Enterprise' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/organization-management pages to have 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/provisioning pages to have 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/recorded-queries pages to have labels cloud,enterprise * Set administration/roles-and-permissions/access-control pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/stats-and-license pages to have labels cloud,enterprise * Set alerting pages to have labels cloud,enterprise,oss * Set breaking-changes pages to have labels cloud,enterprise,oss * Set dashboards pages to have labels cloud,enterprise,oss * Set datasources pages to have labels cloud,enterprise,oss * Set explore pages to have labels cloud,enterprise,oss * Set fundamentals pages to have labels cloud,enterprise,oss * Set introduction/grafana-cloud pages to have labels cloud Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Fix introduction pages products Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set panels-visualizations pages to have labels cloud,enterprise,oss * Set release-notes pages to have labels cloud,enterprise,oss * Set search pages to have labels cloud,enterprise,oss * Set setup-grafana/configure-security/audit-grafana pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/configure-authentication pages to have labels cloud,enterprise,oss * Set setup-grafana/configure-security/configure-authentication/enhanced-ldap pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-authentication/saml pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-database-encryption/encrypt-secrets-using-hashicorp-key-vault pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-request-security pages to have labels cloud,enterprise,oss Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/configure-team-sync pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/export-logs pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set troubleshooting pages to have labels cloud,enterprise,oss * Set whatsnew pages to have labels cloud,enterprise,oss * Apply updated labels from review Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --------- Signed-off-by: Jack Baldry <jack.baldry@grafana.com> Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
583 lines
12 KiB
Markdown
583 lines
12 KiB
Markdown
---
|
|
aliases:
|
|
- ../../http_api/dashboard_versions/
|
|
- ../../http_api/dashboardversions/
|
|
canonical: /docs/grafana/latest/developers/http_api/dashboard_versions/
|
|
description: Grafana Dashboard Versions HTTP API
|
|
keywords:
|
|
- grafana
|
|
- http
|
|
- documentation
|
|
- api
|
|
- dashboard
|
|
- versions
|
|
labels:
|
|
products:
|
|
- enterprise
|
|
- oss
|
|
title: 'Dashboard Versions HTTP API '
|
|
---
|
|
|
|
# Dashboard Versions
|
|
|
|
## Get all dashboard versions
|
|
|
|
{{% admonition type="warning" %}}
|
|
This API is deprecated since Grafana v9.0.0 and will be removed in a future release. Refer to the [new dashboard versions API](#get-all-dashboard-versions-by-dashboard-uid).
|
|
{{% /admonition %}}
|
|
|
|
Query parameters:
|
|
|
|
- **limit** - Maximum number of results to return
|
|
- **start** - Version to start from when returning queries
|
|
|
|
`GET /api/dashboards/id/:dashboardId/versions`
|
|
|
|
Gets all existing dashboard versions for the dashboard with the given `dashboardId`.
|
|
|
|
**Example request for getting all dashboard versions**:
|
|
|
|
```http
|
|
GET /api/dashboards/id/1/versions?limit=2?start=0 HTTP/1.1
|
|
Accept: application/json
|
|
Content-Type: application/json
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
```
|
|
|
|
**Example Response**
|
|
|
|
```http
|
|
HTTP/1.1 200 OK
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length: 428
|
|
|
|
```
|
|
|
|
Status Codes:
|
|
|
|
- **200** - Ok
|
|
- **400** - Errors
|
|
- **401** - Unauthorized
|
|
- **404** - Dashboard version not found
|
|
|
|
## Get all dashboard versions by dashboard UID
|
|
|
|
Query parameters:
|
|
|
|
- **limit** - Maximum number of results to return
|
|
- **start** - Version to start from when returning queries
|
|
|
|
`GET /api/dashboards/uid/:uid/versions`
|
|
|
|
Gets all existing dashboard versions for the dashboard with the given `uid`.
|
|
|
|
**Example request for getting all dashboard versions**:
|
|
|
|
```http
|
|
GET /api/dashboards/uid/QA7wKklGz/versions?limit=2?start=0 HTTP/1.1
|
|
Accept: application/json
|
|
Content-Type: application/json
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
```
|
|
|
|
**Example Response**
|
|
|
|
```http
|
|
HTTP/1.1 200 OK
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length: 428
|
|
|
|
```
|
|
|
|
Status Codes:
|
|
|
|
- **200** - Ok
|
|
- **400** - Errors
|
|
- **401** - Unauthorized
|
|
- **404** - Dashboard version not found
|
|
|
|
## Get dashboard version
|
|
|
|
{{% admonition type="warning" %}}
|
|
This API is deprecated since Grafana v9.0.0 and will be removed in a future release. Refer to the [new get dashboard version API](#get-dashboard-version-by-dashboard-uid).
|
|
{{% /admonition %}}
|
|
|
|
`GET /api/dashboards/id/:dashboardId/versions/:version`
|
|
|
|
Get the dashboard version with the given version, for the dashboard with the given id.
|
|
|
|
**Example request for getting a dashboard version**:
|
|
|
|
```http
|
|
GET /api/dashboards/id/1/versions/1 HTTP/1.1
|
|
Accept: application/json
|
|
Content-Type: application/json
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
```
|
|
|
|
**Example response**:
|
|
|
|
```http
|
|
HTTP/1.1 200 OK
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length: 1300
|
|
|
|
```
|
|
|
|
Status Codes:
|
|
|
|
- **200** - Ok
|
|
- **401** - Unauthorized
|
|
- **404** - Dashboard version not found
|
|
|
|
## Get dashboard version by dashboard UID
|
|
|
|
`GET /api/dashboards/uid/:uid/versions/:version`
|
|
|
|
Get the dashboard version with the given version, for the dashboard with the given UID.
|
|
|
|
**Example request for getting a dashboard version**:
|
|
|
|
```http
|
|
GET /api/dashboards/id/1/versions/1 HTTP/1.1
|
|
Accept: application/json
|
|
Content-Type: application/json
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
```
|
|
|
|
**Example response**:
|
|
|
|
```http
|
|
HTTP/1.1 200 OK
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length: 1300
|
|
|
|
```
|
|
|
|
Status Codes:
|
|
|
|
- **200** - Ok
|
|
- **401** - Unauthorized
|
|
- **404** - Dashboard version not found
|
|
|
|
## Restore dashboard
|
|
|
|
{{% admonition type="warning" %}}
|
|
This API is deprecated since Grafana v9.0.0 and will be removed in a future release. Refer to the [new restore dashboard API](#restore-dashboard-by-dashboard-uid).
|
|
{{% /admonition %}}
|
|
|
|
`POST /api/dashboards/id/:dashboardId/restore`
|
|
|
|
Restores a dashboard to a given dashboard version.
|
|
|
|
**Example request for restoring a dashboard version**:
|
|
|
|
```http
|
|
POST /api/dashboards/id/1/restore
|
|
Accept: application/json
|
|
Content-Type: application/json
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
{
|
|
"version": 1
|
|
}
|
|
```
|
|
|
|
JSON body schema:
|
|
|
|
- **version** - The dashboard version to restore to
|
|
|
|
**Example response**:
|
|
|
|
```http
|
|
HTTP/1.1 200 OK
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length: 67
|
|
|
|
```
|
|
|
|
JSON response body schema:
|
|
|
|
- **slug** - the URL friendly slug of the dashboard's title
|
|
- **status** - whether the restoration was successful or not
|
|
- **version** - the new dashboard version, following the restoration
|
|
|
|
Status codes:
|
|
|
|
- **200** - OK
|
|
- **401** - Unauthorized
|
|
- **404** - Not found (dashboard not found or dashboard version not found)
|
|
- **500** - Internal server error (indicates issue retrieving dashboard tags from database)
|
|
|
|
**Example error response**
|
|
|
|
```http
|
|
HTTP/1.1 404 Not Found
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length: 46
|
|
|
|
```
|
|
|
|
JSON response body schema:
|
|
|
|
- **message** - Message explaining the reason for the request failure.
|
|
|
|
## Restore dashboard by dashboard UID
|
|
|
|
`POST /api/dashboards/uid/:uid/restore`
|
|
|
|
Restores a dashboard to a given dashboard version using `uid`.
|
|
|
|
**Example request for restoring a dashboard version**:
|
|
|
|
```http
|
|
POST /api/dashboards/uid/QA7wKklGz/restore
|
|
Accept: application/json
|
|
Content-Type: application/json
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
{
|
|
"version": 1
|
|
}
|
|
```
|
|
|
|
JSON body schema:
|
|
|
|
- **version** - The dashboard version to restore to
|
|
|
|
**Example response**:
|
|
|
|
```http
|
|
HTTP/1.1 200 OK
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length: 67
|
|
|
|
```
|
|
|
|
JSON response body schema:
|
|
|
|
- **slug** - the URL friendly slug of the dashboard's title
|
|
- **status** - whether the restoration was successful or not
|
|
- **version** - the new dashboard version, following the restoration
|
|
|
|
Status codes:
|
|
|
|
- **200** - OK
|
|
- **401** - Unauthorized
|
|
- **404** - Not found (dashboard not found or dashboard version not found)
|
|
- **500** - Internal server error (indicates issue retrieving dashboard tags from database)
|
|
|
|
**Example error response**
|
|
|
|
```http
|
|
HTTP/1.1 404 Not Found
|
|
Content-Type: application/json; charset=UTF-8
|
|
Content-Length: 46
|
|
|
|
```
|
|
|
|
JSON response body schema:
|
|
|
|
- **message** - Message explaining the reason for the request failure.
|
|
|
|
## Compare dashboard versions
|
|
|
|
`POST /api/dashboards/calculate-diff`
|
|
|
|
Compares two dashboard versions by calculating the JSON diff of them.
|
|
|
|
**Example request**:
|
|
|
|
```http
|
|
POST /api/dashboards/calculate-diff HTTP/1.1
|
|
Accept: text/html
|
|
Content-Type: application/json
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
```
|
|
|
|
JSON body schema:
|
|
|
|
- **base** - an object representing the base dashboard version
|
|
- **new** - an object representing the new dashboard version
|
|
- **diffType** - the type of diff to return. Can be "json" or "basic".
|
|
|
|
**Example response (JSON diff)**:
|
|
|
|
```http
|
|
HTTP/1.1 200 OK
|
|
Content-Type: text/html; charset=UTF-8
|
|
|
|
```
|
|
|
|
The response is a textual representation of the diff, with the dashboard values being in JSON, similar to the diffs seen on sites like GitHub or GitLab.
|
|
|
|
Status Codes:
|
|
|
|
- **200** - Ok
|
|
- **400** - Bad request (invalid JSON sent)
|
|
- **401** - Unauthorized
|
|
- **404** - Not found
|
|
|
|
**Example response (basic diff)**:
|
|
|
|
```http
|
|
HTTP/1.1 200 OK
|
|
Content-Type: text/html; charset=UTF-8
|
|
|
|
```
|
|
|
|
The response here is a summary of the changes, derived from the diff between the two JSON objects.
|
|
|
|
Status Codes:
|
|
|
|
- **200** - OK
|
|
- **400** - Bad request (invalid JSON sent)
|
|
- **401** - Unauthorized
|
|
- **404** - Not found
|