grafana/docs/sources/developer-resources/api-reference/http-api/playlist.md

326 lines
7.4 KiB
Markdown
Raw Permalink Normal View History

---
aliases:
- ../../../http_api/playlist/ # /docs/grafana/next/http_api/playlist/
- ../../../developers/http_api/playlist/ # /docs/grafana/next/developers/http_api/playlist/
canonical: https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/playlist/
description: Playlist Admin HTTP API
keywords:
- grafana
- http
- documentation
- api
- playlist
Explicitly set all front matter labels in the source files (#71548) * Set every page to have defaults of 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration pages to have of 'Cloud', 'Enterprise', and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/enterprise-licensing pages to have 'Enterprise' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/organization-management pages to have 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/provisioning pages to have 'Enterprise' and 'Open source' labels Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/recorded-queries pages to have labels cloud,enterprise * Set administration/roles-and-permissions/access-control pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set administration/stats-and-license pages to have labels cloud,enterprise * Set alerting pages to have labels cloud,enterprise,oss * Set breaking-changes pages to have labels cloud,enterprise,oss * Set dashboards pages to have labels cloud,enterprise,oss * Set datasources pages to have labels cloud,enterprise,oss * Set explore pages to have labels cloud,enterprise,oss * Set fundamentals pages to have labels cloud,enterprise,oss * Set introduction/grafana-cloud pages to have labels cloud Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Fix introduction pages products Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set panels-visualizations pages to have labels cloud,enterprise,oss * Set release-notes pages to have labels cloud,enterprise,oss * Set search pages to have labels cloud,enterprise,oss * Set setup-grafana/configure-security/audit-grafana pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/configure-authentication pages to have labels cloud,enterprise,oss * Set setup-grafana/configure-security/configure-authentication/enhanced-ldap pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-authentication/saml pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-database-encryption/encrypt-secrets-using-hashicorp-key-vault pages to have labels cloud,enterprise * Set setup-grafana/configure-security/configure-request-security pages to have labels cloud,enterprise,oss Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/configure-team-sync pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set setup-grafana/configure-security/export-logs pages to have labels cloud,enterprise Signed-off-by: Jack Baldry <jack.baldry@grafana.com> * Set troubleshooting pages to have labels cloud,enterprise,oss * Set whatsnew pages to have labels cloud,enterprise,oss * Apply updated labels from review Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> --------- Signed-off-by: Jack Baldry <jack.baldry@grafana.com> Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com>
2023-07-18 04:10:12 -04:00
labels:
products:
- enterprise
- oss
- cloud
title: 'Playlist HTTP API '
weight: 100
---
# Playlist API
{{< admonition type="note" >}}
Available in Grafana 12 and later.
This API complies with the new Grafana API structure. To learn more refer to documentation about the [API structure in Grafana](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/developer-resources/api-reference/http-api/apis).
{{< /admonition >}}
## List Playlists
`GET /apis/playlist.grafana.app/v1/namespaces/:namespace/playlists`
Lists all playlists in the specified namespace.
- `namespace`: To learn more about which namespace to use, refer to the [API overview](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/developers/http_api/apis/).
**Example Request**:
```http
GET /apis/playlist.grafana.app/v1/namespaces/default/playlists HTTP/1.1
Accept: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
**Example Response**:
```http
HTTP/1.1 200
Content-Type: application/json
{
"kind": "PlaylistList",
"apiVersion": "playlist.grafana.app/v1",
"metadata": {},
"items": [
{
"kind": "Playlist",
"apiVersion": "playlist.grafana.app/v1",
"metadata": {
"name": "my-playlist-uid",
"namespace": "default",
"resourceVersion": "1234567890",
"creationTimestamp": "2024-01-15T10:30:00Z"
},
"spec": {
"title": "My Playlist",
"interval": "5m",
"items": [
{
"type": "dashboard_by_uid",
"value": "dashboard-uid-1"
},
{
"type": "dashboard_by_tag",
"value": "important"
}
]
}
}
]
}
```
## Get a Playlist
`GET /apis/playlist.grafana.app/v1/namespaces/:namespace/playlists/:name`
Retrieves a specific playlist by name.
- `namespace`: To learn more about which namespace to use, refer to the [API overview](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/developers/http_api/apis/).
- `name`: The UID of the playlist.
**Example Request**:
```http
GET /apis/playlist.grafana.app/v1/namespaces/default/playlists/my-playlist-uid HTTP/1.1
Accept: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
**Example Response**:
```http
HTTP/1.1 200
Content-Type: application/json
{
"kind": "Playlist",
"apiVersion": "playlist.grafana.app/v1",
"metadata": {
"name": "my-playlist-uid",
"namespace": "default",
"resourceVersion": "1234567890",
"creationTimestamp": "2024-01-15T10:30:00Z"
},
"spec": {
"title": "My Playlist",
"interval": "5m",
"items": [
{
"type": "dashboard_by_uid",
"value": "dashboard-uid-1"
},
{
"type": "dashboard_by_tag",
"value": "important"
}
]
}
}
```
## Create a Playlist
`POST /apis/playlist.grafana.app/v1/namespaces/:namespace/playlists`
Creates a new playlist.
- `namespace`: To learn more about which namespace to use, refer to the [API overview](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/developers/http_api/apis/).
**Example Request**:
```http
POST /apis/playlist.grafana.app/v1/namespaces/default/playlists HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"kind": "Playlist",
"apiVersion": "playlist.grafana.app/v1",
"metadata": {
"name": "my-new-playlist-uid"
},
"spec": {
"title": "My New Playlist",
"interval": "5m",
"items": [
{
"type": "dashboard_by_uid",
"value": "dashboard-uid-1"
},
{
"type": "dashboard_by_tag",
"value": "monitoring"
}
]
}
}
```
**Example Response**:
```http
HTTP/1.1 201 Created
Content-Type: application/json
{
"kind": "Playlist",
"apiVersion": "playlist.grafana.app/v1",
"metadata": {
"name": "my-new-playlist-uid",
"namespace": "default",
"resourceVersion": "1234567891",
"creationTimestamp": "2024-01-15T10:35:00Z"
},
"spec": {
"title": "My New Playlist",
"interval": "5m",
"items": [
{
"type": "dashboard_by_uid",
"value": "dashboard-uid-1"
},
{
"type": "dashboard_by_tag",
"value": "monitoring"
}
]
}
}
```
## Update a Playlist
`PUT /apis/playlist.grafana.app/v1/namespaces/:namespace/playlists/:name`
Updates an existing playlist. The entire playlist spec must be provided.
- `namespace`: To learn more about which namespace to use, refer to the [API overview](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/developers/http_api/apis/).
- `name`: The UID of the playlist.
**Example Request**:
```http
PUT /apis/playlist.grafana.app/v1/namespaces/default/playlists/my-playlist-uid HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"kind": "Playlist",
"apiVersion": "playlist.grafana.app/v1",
"metadata": {
"name": "my-playlist-uid",
"namespace": "default",
"resourceVersion": "1234567890"
},
"spec": {
"title": "My Updated Playlist",
"interval": "10m",
"items": [
{
"type": "dashboard_by_uid",
"value": "dashboard-uid-1"
},
{
"type": "dashboard_by_uid",
"value": "dashboard-uid-2"
},
{
"type": "dashboard_by_tag",
"value": "updated-tag"
}
]
}
}
```
**Example Response**:
```http
HTTP/1.1 200 OK
Content-Type: application/json
{
"kind": "Playlist",
"apiVersion": "playlist.grafana.app/v1",
"metadata": {
"name": "my-playlist-uid",
"namespace": "default",
"resourceVersion": "1234567892",
"creationTimestamp": "2024-01-15T10:30:00Z"
},
"spec": {
"title": "My Updated Playlist",
"interval": "10m",
"items": [
{
"type": "dashboard_by_uid",
"value": "dashboard-uid-1"
},
{
"type": "dashboard_by_uid",
"value": "dashboard-uid-2"
},
{
"type": "dashboard_by_tag",
"value": "updated-tag"
}
]
}
}
```
## Delete a Playlist
`DELETE /apis/playlist.grafana.app/v1/namespaces/:namespace/playlists/:name`
Deletes a playlist.
- `namespace`: To learn more about which namespace to use, refer to the [API overview](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/developers/http_api/apis/).
- `name`: The UID of the playlist.
**Example Request**:
```http
DELETE /apis/playlist.grafana.app/v1/namespaces/default/playlists/my-playlist-uid HTTP/1.1
Accept: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
**Example Response**:
```http
HTTP/1.1 200 OK
Content-Type: application/json
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Success",
"code": 200
}
```
## Playlist Item Types
Playlist items support three types:
- `dashboard_by_uid`: Include a specific dashboard by its UID
- `dashboard_by_tag`: Include all dashboards with a specific tag
- `dashboard_by_id`: (Deprecated) Include a dashboard by internal ID