3.6 KiB
Skill: glpi-solve — Close Out a GLPI Ticket
Properly close out a completed GLPI helpdesk ticket. Completing the work is not enough — the ticket status must be set to "Solved", which is what triggers GLPI's config-driven auto-close. Posting a resolution followup documents the work but does not change status, so a ticket left at Solved-less status stays open.
When to use
- Any time work on a GLPI ticket is finished and it should be closed out.
- After posting a root-cause / resolution writeup as an
/ITILFollowup. - During a cleanup sweep of tickets that are done in reality but still open in GLPI.
The rule (from an operator, 2026-07-20)
"Solved" is the correct terminal state to set — not "Closed." GLPI is configured to auto-close Solved tickets after its delay. If you only post a followup and never set status, the ticket sits open (this bit us on a real incident where resolution followups were posted but status was never advanced, leaving tickets open, which the operator had to mark Solved by hand).
Close-out = followup (optional but preferred) + set status to Solved.
GLPI status IDs
| ID | Status | |
|---|---|---|
| 1 | New | |
| 2 | Processing (assigned) | |
| 3 | Processing (planned) | |
| 4 | Pending / Waiting | |
| 5 | Solved | ← set this on close-out |
| 6 | Closed | ← happens automatically; do not set manually |
Procedure
1. Get a session token
SESSION=$(~/.config/mosaic/tools/glpi/session-init.sh -q)
source ~/.config/mosaic/tools/_lib/credentials.sh && load_credentials glpi
2. (Preferred) Post the resolution followup
Use the top-level /ITILFollowup endpoint — the /Ticket/<id>/ITILFollowup
sub-resource returns permission errors even as Super-Admin (known GLPI quirk).
TICKET_ID=<id>
curl -sk -X POST "${GLPI_URL}/ITILFollowup" \
-H "App-Token: $GLPI_APP_TOKEN" \
-H "Session-Token: $SESSION" \
-H "Content-Type: application/json" \
-d "{\"input\":{\"itemtype\":\"Ticket\",\"items_id\":${TICKET_ID},\"content\":\"<resolution summary>\"}}"
3. Set status to Solved (the step that actually closes it out)
curl -sk -X PUT "${GLPI_URL}/Ticket/${TICKET_ID}" \
-H "App-Token: $GLPI_APP_TOKEN" \
-H "Session-Token: $SESSION" \
-H "Content-Type: application/json" \
-d "{\"input\":{\"id\":${TICKET_ID},\"status\":5}}"
Expect HTTP 200/201. GLPI will auto-close it later per its config — leave status at 5.
4. Verify
curl -sk "${GLPI_URL}/Ticket/${TICKET_ID}?expand_dropdowns=true" \
-H "App-Token: $GLPI_APP_TOKEN" -H "Session-Token: $SESSION" \
| jq '{id, name, status}'
status should read Solved (or 5).
Optional: sweep for done-but-open tickets
List tickets still open (New/Processing/Pending) to spot ones whose work is actually finished but were never marked Solved:
~/.config/mosaic/tools/glpi/ticket-list.sh -s processing -f table
~/.config/mosaic/tools/glpi/ticket-list.sh -s pending -f table
Review each; for any that are genuinely resolved, run steps 2–3.
Guardrails
- Read-only until you intend to close — confirm the ticket is actually done first.
- Never echo the GLPI app/user/session tokens.
- Set Solved (5), never Closed (6) — auto-close owns that transition.