# Skill: glpi-followup — Add a Followup to a GLPI Ticket

> Post a followup (comment / progress note / resolution writeup) to a GLPI ticket.
> This documents work but does **not** change the ticket status — to close a ticket
> out, follow with **[[glpi-solve]]** to set status to Solved.

## When to use

- Recording progress, a decision, or a root-cause/resolution note on a ticket.
- The documentation step that usually precedes closing a ticket out (`glpi-solve`).

## Critical quirk

Use the **top-level `/ITILFollowup` endpoint**, NOT `/Ticket/<id>/ITILFollowup`. The
sub-resource path returns permission errors even with a Super-Admin profile.

## Procedure

### 1. Session + creds

```bash
SESSION=$(~/.config/mosaic/tools/glpi/session-init.sh -q)
source ~/.config/mosaic/tools/_lib/credentials.sh && load_credentials glpi
```

### 2. Post the followup

```bash
TICKET_ID=<id>
CONTENT="<the followup text>"
curl -sk -X POST "${GLPI_URL}/ITILFollowup" \
  -H "App-Token: $GLPI_APP_TOKEN" \
  -H "Session-Token: $SESSION" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --argjson id "$TICKET_ID" --arg c "$CONTENT" \
        '{input:{itemtype:"Ticket", items_id:$id, content:$c}}')"
```

Expect HTTP 201. Building the payload with `jq` keeps quotes/newlines in the content safe.

### 3. Long or multi-paragraph content

Write the note to a file first, then read it into the payload:

```bash
curl -sk -X POST "${GLPI_URL}/ITILFollowup" \
  -H "App-Token: $GLPI_APP_TOKEN" -H "Session-Token: $SESSION" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --argjson id "$TICKET_ID" --rawfile c /path/to/note.md \
        '{input:{itemtype:"Ticket", items_id:$id, content:$c}}')"
```

## Guardrails

- Never echo the GLPI app/user/session tokens.
- A followup alone leaves the ticket open. If the work is done, run **[[glpi-solve]]** next.
