Skip to content

Revisions

Revision endpoints are available for entities annotated with Hibernate Envers @Audited. Every create, update, or delete produces a revision that can be queried via the API.

See Auditing for how to enable auditing on your entities.

List Revisions for a Record

Returns the revision history for a specific entity instance.

http
GET /api/{entity}/{id}/revisions
GET /api/{entity}/{id}/revisions?page={page}&size={size}
ParameterRequiredDefaultDescription
pageNoPage index (0-based). If omitted, returns up to 100 000 revisions.
sizeNo10Records per page (requires page to be set)

Example:

http
GET /api/product/AB-001/revisions?page=0&size=10

Response (200 OK) — a page of RevisionData:

json
{
  "content": [
    {
      "number": 42,
      "date": "2024-03-01T10:30:00.000+00:00",
      "userId": "[email protected]",
      "revisionType": "MOD",
      "directChange": true,
      "mainEntity": true,
      "changedFields": ["price", "status"],
      "notAuditedFields": [],
      "entityData": {
        "reference": "AB-001",
        "name": "Headphones",
        "price": 179.99,
        "status": "LOW_STOCK"
      }
    }
  ],
  "totalElements": 5,
  "totalPages": 1,
  "size": 10,
  "number": 0
}

RevisionData Fields

FieldDescription
numberRevision number (global Envers revision ID)
dateTimestamp when the revision was created
userIdID/username of the user who made the change
revisionTypeADD (create), MOD (update), or DEL (delete)
directChangetrue if the entity itself changed; false if the revision was caused by a related entity change
mainEntityWhether this is the main entity or a related one in the audit trail
changedFieldsSet of field names that changed in this revision
notAuditedFieldsFields present in the entity but not tracked by Envers
entityDataFull snapshot of the entity at this revision

Get Entity State at a Specific Revision

Returns the entity as it was at a given revision number.

http
GET /api/{entity}/{id}/revisions/{revisionNumber}

Example:

http
GET /api/product/AB-001/revisions/42

Response (200 OK) — the entity snapshot:

json
{
  "reference": "AB-001",
  "name": "Headphones",
  "price": 179.99,
  "status": "LOW_STOCK"
}

Revision Summary (all records)

Returns revisions across all records of the entity type, not just a single one.

http
GET /api/{entity}/revisions/summary
GET /api/{entity}/revisions/summary?page={page}&size={size}
ParameterRequiredDefaultDescription
pageNoPage index (0-based). If omitted, returns up to 100 000 revisions.
sizeNo10Records per page (requires page to be set)

Example:

http
GET /api/product/revisions/summary?page=0&size=20

Response shape is the same as the per-record revisions endpoint.

Access Control

Requires the audit authority for the entity. See RBAC.