播放列表 API - Amazon Managed Grafana

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

播放列表 API

使用播放列表 API 在亚马逊托管 Grafana 工作区中处理播放列表。

注意

要在亚马逊托管 Grafana 工作空间中使用 Grafana API,您必须拥有有效的 Grafana API 令牌。您可以将其包含在 API 请求的Authorization字段中。有关如何创建令牌来验证您的 API 调用的信息,请参阅使用令牌进行身份验证

GET /api/playlists

使用分页返回当前 Amazon Managed Grafana 工作空间的所有播放列表。

示例请求

GET /api/playlists HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

查询字符串参数:

  • query-将响应限制为名称类似于此值的播放列表。

  • li mit — 将响应限制为 X 个播放列表。

响应示例

HTTP/1.1 200 Content-Type: application/json [ { "id": 1, "name": "my playlist", "interval": "5m" } ]

获取一个播放列表

GET /api/playlists/:id

示例请求

GET /api/playlists/1 HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

响应示例

HTTP/1.1 200 Content-Type: application/json { "id" : 1, "name": "my playlist", "interval": "5m", "orgId": "my org", "items": [ { "id": 1, "playlistId": 1, "type": "dashboard_by_id", "value": "3", "order": 1, "title":"my third dashboard" }, { "id": 2, "playlistId": 1, "type": "dashboard_by_tag", "value": "myTag", "order": 2, "title":"my other dashboard" } ] }

获取播放列表项目

GET /api/playlists/:id/items

示例请求

GET /api/playlists/1/items HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

响应示例

HTTP/1.1 200 Content-Type: application/json [ { "id": 1, "playlistId": 1, "type": "dashboard_by_id", "value": "3", "order": 1, "title":"my third dashboard" }, { "id": 2, "playlistId": 1, "type": "dashboard_by_tag", "value": "myTag", "order": 2, "title":"my other dashboard" } ]

获取播放列表仪表板

GET /api/playlists/:id/dashboards

示例请求

GET /api/playlists/1/dashboards HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

响应示例

HTTP/1.1 200 Content-Type: application/json [ { "id": 3, "title": "my third dashboard", "order": 1, }, { "id": 5, "title":"my other dashboard" "order": 2, } ]

创建播放列表

POST /api/playlists/

示例请求

PUT /api/playlists/1 HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk { "name": "my playlist", "interval": "5m", "items": [ { "type": "dashboard_by_id", "value": "3", "order": 1, "title":"my third dashboard" }, { "type": "dashboard_by_tag", "value": "myTag", "order": 2, "title":"my other dashboard" } ] }

响应示例

HTTP/1.1 200 Content-Type: application/json { "id": 1, "name": "my playlist", "interval": "5m" }

更新播放列表

PUT /api/playlists/:id

示例请求

PUT /api/playlists/1 HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk { "name": "my playlist", "interval": "5m", "items": [ { "playlistId": 1, "type": "dashboard_by_id", "value": "3", "order": 1, "title":"my third dashboard" }, { "playlistId": 1, "type": "dashboard_by_tag", "value": "myTag", "order": 2, "title":"my other dashboard" } ] }

响应示例

HTTP/1.1 200 Content-Type: application/json { "id" : 1, "name": "my playlist", "interval": "5m", "orgId": "my org", "items": [ { "id": 1, "playlistId": 1, "type": "dashboard_by_id", "value": "3", "order": 1, "title":"my third dashboard" }, { "id": 2, "playlistId": 1, "type": "dashboard_by_tag", "value": "myTag", "order": 2, "title":"my other dashboard" } ] }

删除播放列表

DELETE /api/playlists/:id

示例请求

DELETE /api/playlists/1 HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

响应示例

HTTP/1.1 200 Content-Type: application/json {}