2022-05-26 23:06:25 +08:00
|
|
|
---
|
|
|
|
|
aliases:
|
|
|
|
|
- /docs/grafana/latest/developers/http_api/playlist/
|
|
|
|
|
- /docs/grafana/latest/http_api/playlist/
|
|
|
|
|
description: Playlist Admin HTTP API
|
|
|
|
|
keywords:
|
|
|
|
|
- grafana
|
|
|
|
|
- http
|
|
|
|
|
- documentation
|
|
|
|
|
- api
|
|
|
|
|
- playlist
|
|
|
|
|
title: 'Playlist HTTP API '
|
|
|
|
|
---
|
2018-07-17 22:45:39 +08:00
|
|
|
|
|
|
|
|
# Playlist API
|
|
|
|
|
|
|
|
|
|
## Search Playlist
|
|
|
|
|
|
|
|
|
|
`GET /api/playlists`
|
|
|
|
|
|
|
|
|
|
Get all existing playlist for the current organization using pagination
|
|
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
GET /api/playlists HTTP/1.1
|
|
|
|
|
Accept: application/json
|
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
|
```
|
|
|
|
|
|
2021-08-06 21:52:36 +08:00
|
|
|
Querystring Parameters:
|
2018-07-17 22:45:39 +08:00
|
|
|
|
2021-08-06 21:52:36 +08:00
|
|
|
These parameters are used as querystring parameters.
|
2019-04-09 23:30:21 +08:00
|
|
|
|
2021-08-06 21:52:36 +08:00
|
|
|
- **query** - Limit response to playlist having a name like this value.
|
|
|
|
|
- **limit** - Limit response to _X_ number of playlist.
|
2018-07-17 22:45:39 +08:00
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
HTTP/1.1 200
|
|
|
|
|
Content-Type: application/json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"id": 1,
|
|
|
|
|
"name": "my playlist",
|
|
|
|
|
"interval": "5m"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Get one playlist
|
|
|
|
|
|
|
|
|
|
`GET /api/playlists/:id`
|
|
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
GET /api/playlists/1 HTTP/1.1
|
|
|
|
|
Accept: application/json
|
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
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,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my third dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 2,
|
|
|
|
|
"playlistId": 1,
|
|
|
|
|
"type": "dashboard_by_tag",
|
|
|
|
|
"value": "myTag",
|
|
|
|
|
"order": 2,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my other dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Get Playlist items
|
|
|
|
|
|
|
|
|
|
`GET /api/playlists/:id/items`
|
|
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
GET /api/playlists/1/items HTTP/1.1
|
|
|
|
|
Accept: application/json
|
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
HTTP/1.1 200
|
|
|
|
|
Content-Type: application/json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"id": 1,
|
|
|
|
|
"playlistId": 1,
|
|
|
|
|
"type": "dashboard_by_id",
|
|
|
|
|
"value": "3",
|
|
|
|
|
"order": 1,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my third dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 2,
|
|
|
|
|
"playlistId": 1,
|
|
|
|
|
"type": "dashboard_by_tag",
|
|
|
|
|
"value": "myTag",
|
|
|
|
|
"order": 2,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my other dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Get Playlist dashboards
|
|
|
|
|
|
|
|
|
|
`GET /api/playlists/:id/dashboards`
|
|
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
GET /api/playlists/1/dashboards HTTP/1.1
|
|
|
|
|
Accept: application/json
|
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
HTTP/1.1 200
|
|
|
|
|
Content-Type: application/json
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"id": 3,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title": "my third dashboard",
|
2018-07-17 22:45:39 +08:00
|
|
|
"order": 1,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 5,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my other dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
"order": 2,
|
2019-04-09 23:30:21 +08:00
|
|
|
|
2018-07-17 22:45:39 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Create a playlist
|
|
|
|
|
|
|
|
|
|
`POST /api/playlists/`
|
|
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
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,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my third dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"type": "dashboard_by_tag",
|
|
|
|
|
"value": "myTag",
|
|
|
|
|
"order": 2,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my other dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
HTTP/1.1 200
|
|
|
|
|
Content-Type: application/json
|
|
|
|
|
{
|
|
|
|
|
"id": 1,
|
|
|
|
|
"name": "my playlist",
|
|
|
|
|
"interval": "5m"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Update a playlist
|
|
|
|
|
|
|
|
|
|
`PUT /api/playlists/:id`
|
|
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
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,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my third dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"playlistId": 1,
|
|
|
|
|
"type": "dashboard_by_tag",
|
|
|
|
|
"value": "myTag",
|
|
|
|
|
"order": 2,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my other dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
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,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my third dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"id": 2,
|
|
|
|
|
"playlistId": 1,
|
|
|
|
|
"type": "dashboard_by_tag",
|
|
|
|
|
"value": "myTag",
|
|
|
|
|
"order": 2,
|
2020-07-01 05:42:50 +08:00
|
|
|
"title":"my other dashboard"
|
2018-07-17 22:45:39 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Delete a playlist
|
|
|
|
|
|
|
|
|
|
`DELETE /api/playlists/:id`
|
|
|
|
|
|
|
|
|
|
**Example Request**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
DELETE /api/playlists/1 HTTP/1.1
|
|
|
|
|
Accept: application/json
|
|
|
|
|
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Example Response**:
|
|
|
|
|
|
2020-01-27 20:41:15 +08:00
|
|
|
```http
|
2018-07-17 22:45:39 +08:00
|
|
|
HTTP/1.1 200
|
|
|
|
|
Content-Type: application/json
|
|
|
|
|
{}
|
|
|
|
|
```
|