

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# Playlist-API
<a name="Grafana-API-Playlist"></a>

Verwenden Sie die Playlist-API, um mit Playlisten im Amazon Managed Grafana-Arbeitsbereich zu arbeiten. 

**Anmerkung**  
Um eine Grafana-API mit Ihrem Amazon Managed Grafana-Workspace verwenden zu können, benötigen Sie ein gültiges Grafana-API-Token. Sie fügen dies in das `Authorization` Feld in der API-Anfrage ein. Informationen zum Erstellen eines Tokens zur Authentifizierung Ihrer API-Aufrufe finden Sie unter[Authentifizieren Sie sich mit Tokens](authenticating-grafana-apis.md).

## Playlist durchsuchen
<a name="Grafana-API-Playlist-search"></a>

```
GET /api/playlists
```

Gibt alle Playlisten für den aktuellen Amazon Managed Grafana-Arbeitsbereich mithilfe von Paginierung zurück.

**Beispielanforderung**

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

Querystring-Parameter:
+ **query** — Beschränkt die Antworten auf Playlisten, die einen Namen wie diesen Wert haben.
+ **Limit** — Beschränkt die Antwort auf die X-Anzahl von Playlisten.

**Beispielantwort**

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

## Holen Sie sich eine Playlist
<a name="Grafana-API-Playlist-getone"></a>

```
GET /api/playlists/:id
```

**Beispielanforderung**

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

**Beispielantwort**

```
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"
    }
  ]
}
```

## Holen Sie sich Playlist-Elemente
<a name="Grafana-API-Playlist-get-items"></a>

```
GET /api/playlists/:id/items
```

**Beispielanforderung**

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

**Beispielantwort**

```
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"
  }
]
```

## Holen Sie sich Playlist-Dashboards
<a name="Grafana-API-Playlist-get-dashboards"></a>

```
GET /api/playlists/:id/dashboards
```

**Beispielanforderung**

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

**Beispielantwort**

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

  }
]
```

## Erstelle eine Playlist
<a name="Grafana-API-Playlist-create"></a>

```
POST /api/playlists/
```

**Beispielanforderung**

```
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"
      }
    ]
  }
```

**Beispielantwort**

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

## Aktualisiere eine Playlist
<a name="Grafana-API-Playlist-update"></a>

```
PUT /api/playlists/:id
```

**Beispielanforderung**

```
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"
      }
    ]
  }
```

**Beispielantwort**

```
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"
    }
  ]
}
```

## Eine Playlist löschen
<a name="Grafana-API-Playlist-delete"></a>

```
DELETE /api/playlists/:id
```

**Beispielanforderung**

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

**Beispielantwort**

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