API · v1 · stable
CODEMETA OSDeveloper Center
EN
Open console
Tutorial

Export a ticket's audit history

Reading time · 7 minUpdated · 1 May 2026

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.

  1. Prerequisites. You are signed in (cookies.txt present), know the tenant and ticket ID, and your account has read permission on the ticket.

  2. 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.txt

    Response:

    {
      "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
      }
    }
  3. Walk through cursor pagination. As long as hasMore is true, fetch the next page with cursor=<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')
    done
  4. Apply 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/update patches in ascending chronological order.

Search