diff --git a/docs/sources/http_api/dashboard.md b/docs/sources/http_api/dashboard.md index b16f105b643..11c0273ed77 100644 --- a/docs/sources/http_api/dashboard.md +++ b/docs/sources/http_api/dashboard.md @@ -440,6 +440,100 @@ Content-Type: application/json ## Dashboard Search See [Folder/Dashboard Search API]({{< relref "folder_dashboard_search.md" >}}). +## Remove default values in dashboard + +`POST /api/dashboards/trim` + +Will remove default values from input dashboard JSON. + +**Example Request for trimming dashboard JSON**: + +```http +POST /api/dashboards/uid/trim HTTP/1.1 +Accept: application/json +Content-Type: application/json +Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + +{ + "meta": { + "isStarred": false, + "url": "/d/cIBgcSjkk/production-overview", + "folderId": 2, + "folderUid": "l3KqBxCMz", + "slug": "production-overview" + }, + "dashboard": { + "id": 112, + "panels": [ + { + "datasource": null, + "description": "", + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "feedUrl": "https://grafana.com/blog/news.xml", + "showImage": true + }, + "pluginVersion": "8.1.0-pre", + "title": "Panel Title", + "type": "news" + } + ], + "title": "test dashboard", + "uid": "9lzdzI3Mz", + "version": 2 + } +} +``` + +**Example Response**: + +```http +HTTP/1.1 200 +Content-Type: application/json + +{ + "meta": { + "folderId": 2, + "folderUid": "l3KqBxCMz", + "isStarred": false, + "slug": "production-overview", + "url": "/d/cIBgcSjkk/production-overview" + }, + "dashboard": { + "id": 112, + "panels": [ + { + "gridPos": {}, + "id": 2, + "options": { + "feedUrl": "https://grafana.com/blog/news.xml", + "showImage": true + }, + "pluginVersion": "8.1.0-pre", + "title": "Panel Title", + "type": "news" + } + ], + "title": "test dashboard", + "uid": "9lzdzI3Mz", + "version": 2 + } +} +``` + +Status Codes: + +- **200** – Trimmed +- **400** – Errors (invalid json, missing or invalid fields, etc) +- **401** – Unauthorized +- **403** – Access denied + ## Deprecated resources Please note that these resource have been deprecated and will be removed in a future release. @@ -541,97 +635,3 @@ Content-Length: 97 "status": "multiple-slugs-exists" } ``` - -## Trim input dashboard - -`POST /api/dashboards/trim` - -Will remove the default values from input dashboard JSON. - -**Example Request for trimming dashboard JSON**: - -```http -POST /api/dashboards/uid/trim HTTP/1.1 -Accept: application/json -Content-Type: application/json -Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk - -{ - "meta": { - "isStarred": false, - "url": "/d/cIBgcSjkk/production-overview", - "folderId": 2, - "folderUid": "l3KqBxCMz", - "slug": "production-overview" - }, - "dashboard": { - "id": 112, - "panels": [ - { - "datasource": null, - "description": "", - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 2, - "options": { - "feedUrl": "https://grafana.com/blog/news.xml", - "showImage": true - }, - "pluginVersion": "8.1.0-pre", - "title": "Panel Title", - "type": "news" - } - ], - "title": "test dashboard", - "uid": "9lzdzI3Mz", - "version": 2 - } -} -``` - -**Example Response**: - -```http -HTTP/1.1 200 -Content-Type: application/json - -{ - "meta": { - "folderId": 2, - "folderUid": "l3KqBxCMz", - "isStarred": false, - "slug": "production-overview", - "url": "/d/cIBgcSjkk/production-overview" - }, - "dashboard": { - "id": 112, - "panels": [ - { - "gridPos": {}, - "id": 2, - "options": { - "feedUrl": "https://grafana.com/blog/news.xml", - "showImage": true - }, - "pluginVersion": "8.1.0-pre", - "title": "Panel Title", - "type": "news" - } - ], - "title": "test dashboard", - "uid": "9lzdzI3Mz", - "version": 2 - } -} -``` - -Status Codes: - -- **200** – Trimmed -- **400** – Errors (invalid json, missing or invalid fields, etc) -- **401** – Unauthorized -- **403** – Access denied \ No newline at end of file