

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 資料夾/儀表板搜尋 API
<a name="Grafana-API-FolderDashboard-Search"></a>

使用 FolderDashboard-Search API 搜尋 Amazon Managed Grafana 工作區中的資料夾和儀表板。

**注意**  
若要搭配 Amazon Managed Grafana 工作區使用 Grafana API，您必須擁有有效的 Grafana API 字符。您可以在 API 請求的 `Authorization` 欄位中包含此項目。如需如何建立權杖以驗證 API 呼叫的詳細資訊，請參閱 [使用字符進行驗證](authenticating-grafana-apis.md)。

## 搜尋資料夾和儀表板
<a name="Grafana-API-FolderDashboard-Search-create"></a>

```
GET /api/search/
```

查詢參數：
+ **查詢** — 搜尋查詢
+ **tag** — 要搜尋的標籤清單。這些是 Grafana 標籤，而不是 AWS 標籤。
+ **type** — 要搜尋的類型， `dash-folder`或 `dash-db`。
+ **dashboardIds** — 要搜尋的儀表板 ID 清單。
+ **folderIds** — 在儀表板中搜尋的儀表板 ID 清單。
+ **starred** - 指定僅傳回星號儀表板的旗標。
+ **limit** - 限制傳回的結果數量 （上限為 5000)。
+ **page** — 使用此參數來存取超出限制的命中。編號從 1 開始。`limit` 參數做為頁面大小。

**擷取一般資料夾資料夾和儀表板的範例請求**

```
GET /api/search?folderIds=0&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",
    "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",
    "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

[HTTP/1.1 200
Content-Type: application/json

[
  {
    "id":1,
    "uid": "cIBgcSjkk",
    "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
  }
]
```