Export a ticket's audit history
Every mutation of an entity leaves an RFC 6902 JSON patch in the audit trail. This tutorial shows how to read it out completely per entity.
Background
Each entity has a timeline route. With ?filter=history you get
only the audit entries (otherwise comments,
status changes etc. are returned as well).
The route is GET /api/v1/<resource>/<id>/timeline. Learn more in the concept
Audit history.
Prerequisites. You are signed in (
cookies.txtpresent), know the tenant and ticket ID, and your account has read permission on the ticket.Fetch the first page.
curl "https://os.codemeta.de/api/v1/tickets/$TICKET_ID/timeline?filter=history&limit=50" \ -H "X-Tenant-Id: $TENANT" \ -b cookies.txtResponse:
{ "data": [ { "id": "01938442-…", "operation": "update", "patch": [ { "op": "replace", "path": "/priority", "value": "high" } ], "actor": "0193…", "at": "2026-04-30T14:08:11.092Z" } ], "meta": { "nextCursor": "0193e2a0-…", "hasMore": true, "limit": 50 } }Walk through cursor pagination. As long as
hasMoreis true, fetch the next page withcursor=<nextCursor>:NEXT="0193e2a0-…" while [ -n "$NEXT" ]; do RES=$(curl -s "https://os.codemeta.de/api/v1/tickets/$TICKET_ID/timeline?filter=history&limit=50&cursor=$NEXT" \ -H "X-Tenant-Id: $TENANT" \ -b cookies.txt) echo "$RES" | jq '.data[]' NEXT=$(echo "$RES" | jq -r '.meta.nextCursor // empty') doneApply patches locally (optional). If you want to reconstruct the state of the entity at a specific point in time, additionally fetch the current state and work backwards through the patches.
Most JSON patch implementations can invert a patch as long as the prior state is known. In practice it is easier to start with an empty initial state and apply all
create/updatepatches in ascending chronological order.