La supervision doit ouvrir automatiquement un ticket dans GLPI (https://glpi.acme.test/apirest.php). Jeton d'application : $GLPI_APP_TOKEN, jeton utilisateur : $GLPI_USER_TOKEN (variables déjà chargées). Travaillez dans ~/glpi.
- Ouvrez une session :
curl -s -H "App-Token: $GLPI_APP_TOKEN" -H "Authorization: user_token $GLPI_USER_TOKEN" https://glpi.acme.test/apirest.php/initSession
ticket.json : {"input": {...}} avec name Sauvegarde nocturne en échec - srv-db01, content (description), type 1 (incident), urgency 4 (haute), itilcategories_id 12
- Créez le ticket :
curl -s -X POST -H "App-Token: $GLPI_APP_TOKEN" -H "Session-Token: <jeton>" -H "Content-Type: application/json" -d @ticket.json https://glpi.acme.test/apirest.php/Ticket → numéro → answer ticket <id>
- Fermez la session (
…/killSession avec les mêmes en-têtes App-Token et Session-Token, méthode GET)