文件夹/仪表盘搜索 API
搜索文件夹和仪表盘
GET /api/search/
注意:使用基于角色的访问控制时,搜索结果仅包含您有权访问的仪表盘和文件夹。
查询参数
- query – 搜索查询
- tag – 要搜索的标签列表
- type – 要搜索的类型,
dash-folder
或dash-db
- dashboardIds – 要搜索的仪表盘 ID 列表
- dashboardUID - 要搜索的仪表盘 UID 列表,自 Grafana v9.1 起已弃用,请改用 dashboardUIDs
- dashboardUIDs – 要搜索的仪表盘 UID 列表
- folderUIDs – 要在其中搜索的文件夹 UID 列表
- starred – 指示是否仅返回已加星标的仪表盘的标志
- limit – 限制返回结果的数量(最大 5000;默认 1000)
- page – 使用此参数访问超出 limit 的结果。编号从 1 开始。limit 参数作为页面大小。
检索根级别文件夹和仪表盘的示例请求:
GET /api/search?query=&starred=false HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
检索根级别文件夹和仪表盘的示例响应:
HTTP/1.1 200
Content-Type: application/json
[
{
"id": 163,
"uid": "000000163",
"orgId": 1,
"title": "Folder",
"url": "/dashboards/f/000000163/folder",
"type": "dash-folder",
"tags": [],
"isStarred": false,
"uri":"db/folder" // deprecated in Grafana v5.0
},
{
"id":1,
"uid": "cIBgcSjkk",
"orgId": 1,
"title":"Production Overview",
"url": "/d/cIBgcSjkk/production-overview",
"type":"dash-db",
"tags":[prod],
"isStarred":true,
"uri":"db/production-overview" // deprecated in Grafana v5.0
}
]
搜索仪表盘的示例请求:
GET /api/search?query=Production%20Overview&starred=true&tag=prod HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
搜索仪表盘的示例响应:
HTTP/1.1 200
Content-Type: application/json
[
{
"id":1,
"uid": "cIBgcSjkk",
"orgId": 1,
"title":"Production Overview",
"url": "/d/cIBgcSjkk/production-overview",
"type":"dash-db",
"tags":[prod],
"isStarred":true,
"folderId": 2,
"folderUid": "000000163",
"folderTitle": "Folder",
"folderUrl": "/dashboards/f/000000163/folder",
"uri":"db/production-overview" // deprecated in Grafana v5.0
}
]