From e38d8cd8aff8b348c60ee0360fa2f9a0628dcb4f Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Wed, 2 Feb 2022 18:46:03 +0100 Subject: [PATCH] Library Elements API GET by name returns array (#44743) (#44751) * Library Elements API GET by name returns array Making a GET request to the Library Elements HTTP API `api/library-elements/name/:name` will return an **array** of Library Element objects, but the documentation says it will return a Library Element object. Example cURL POST request: `curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer XXXXXXXXXXX" -d @request.json "https://my.grafana.net/api/library-elements/"` request.json ```json { "model": {}, "kind": 1, "name": "testing description3", "uid": "basic3", "id": 12345, "version": 2 } ``` Example cURL GET request: `curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer XXXXXXXX" -d @request "https://my/api/library-elements/name/testing description3"` Example response: ```json { "result": [ { . . . } ] } ``` * Library Elements API fix bracket spacing (cherry picked from commit 925333bfa44153e9e41a43f7af3d86a1b276de78) Co-authored-by: JM --- docs/sources/http_api/library_element.md | 60 ++++++++++++------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/docs/sources/http_api/library_element.md b/docs/sources/http_api/library_element.md index 3060a3ed80a..1d0cb086297 100644 --- a/docs/sources/http_api/library_element.md +++ b/docs/sources/http_api/library_element.md @@ -176,35 +176,37 @@ HTTP/1.1 200 Content-Type: application/json { - "result": { - "id": 25, - "orgId": 1, - "folderId": 0, - "uid": "V--OrYHnz", - "name": "API docs Example", - "kind": 1, - "type": "text", - "description": "", - "model": {...}, - "version": 1, - "meta": { - "folderName": "General", - "folderUid": "", - "connectedDashboards": 1, - "created": "2021-09-27T09:56:17+02:00", - "updated": "2021-09-27T09:56:17+02:00", - "createdBy": { - "id": 1, - "name": "admin", - "avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56" - }, - "updatedBy": { - "id": 1, - "name": "admin", - "avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56" - } - } - } + "result": [ + { + "id": 25, + "orgId": 1, + "folderId": 0, + "uid": "V--OrYHnz", + "name": "API docs Example", + "kind": 1, + "type": "text", + "description": "", + "model": {...}, + "version": 1, + "meta": { + "folderName": "General", + "folderUid": "", + "connectedDashboards": 1, + "created": "2021-09-27T09:56:17+02:00", + "updated": "2021-09-27T09:56:17+02:00", + "createdBy": { + "id": 1, + "name": "admin", + "avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56" + }, + "updatedBy": { + "id": 1, + "name": "admin", + "avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56" + } + } + } + ] } ```