菜单
文档breadcrumb arrow Grafana 文档breadcrumb arrow 开发者breadcrumb arrow HTTP APIbreadcrumb arrow 播放列表 HTTP API
Enterprise Open source

播放列表 API

搜索播放列表

GET /api/playlists

使用分页获取当前组织的所有现有播放列表

请求示例:

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

查询字符串参数

这些参数用作查询字符串参数。

  • query - 将响应限制为名称包含此值的播放列表。
  • limit - 将响应限制为 *X* 个播放列表。

响应示例:

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

获取单个播放列表

GET /api/playlists/:uid

请求示例:

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

响应示例:

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

获取播放列表项

GET /api/playlists/:uid/items

请求示例:

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

响应示例:

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

创建播放列表

POST /api/playlists/

请求示例:

http
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_uid",
        "value": "3",
        "order": 1,
        "title":"my third dashboard"
      },
      {
        "type": "dashboard_by_tag",
        "value": "myTag",
        "order": 2,
        "title":"my other dashboard"
      }
    ]
  }

响应示例:

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

更新播放列表

PUT /api/playlists/:uid

请求示例:

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

响应示例:

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

删除播放列表

DELETE /api/playlists/:uid

请求示例:

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

响应示例:

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