Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.
API de playlist
Utilisez l'API Playlist pour travailler avec des playlists dans l'espace de travail Amazon Managed Grafana.
Note
Pour utiliser une API Grafana avec votre espace de travail Amazon Managed Grafana, vous devez disposer d'un jeton d'API Grafana valide. Vous l'incluez dans le Authorization
champ de la demande d'API. Pour plus d'informations sur la création d'un jeton pour authentifier vos appels d'API, consultezAuthentifiez-vous avec des jetons.
Rechercher une playlist
GET /api/playlists
Renvoie toutes les playlists de l'espace de travail Amazon Managed Grafana actuel, en utilisant la pagination.
Exemple de demande
GET /api/playlists HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Paramètres de chaîne de requête :
-
query — Limitez les réponses aux playlists portant un nom similaire à cette valeur.
-
limit — Limite la réponse à un nombre X de playlists.
Exemple de réponse
HTTP/1.1 200 Content-Type: application/json [ { "id": 1, "name": "my playlist", "interval": "5m" } ]
Obtenez une playlist
GET /api/playlists/:id
Exemple de demande
GET /api/playlists/1 HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Exemple de réponse
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" } ] }
Obtenir des éléments de playlist
GET /api/playlists/:id/items
Exemple de demande
GET /api/playlists/1/items HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Exemple de réponse
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" } ]
Obtenez des tableaux de bord de playlists
GET /api/playlists/:id/dashboards
Exemple de demande
GET /api/playlists/1/dashboards HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Exemple de réponse
HTTP/1.1 200 Content-Type: application/json [ { "id": 3, "title": "my third dashboard", "order": 1, }, { "id": 5, "title":"my other dashboard" "order": 2, } ]
Création d'une playlist
POST /api/playlists/
Exemple de demande
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" } ] }
Exemple de réponse
HTTP/1.1 200 Content-Type: application/json { "id": 1, "name": "my playlist", "interval": "5m" }
Mettre à jour une playlist
PUT /api/playlists/:id
Exemple de demande
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" } ] }
Exemple de réponse
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" } ] }
Supprimer une playlist
DELETE /api/playlists/:id
Exemple de demande
DELETE /api/playlists/1 HTTP/1.1 Accept: application/json Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
Exemple de réponse
HTTP/1.1 200 Content-Type: application/json {}