Revisions

Revisions are individual changes to items made. Directus keeps track of changes made, so you're able to revert to a previous state at will.

Endpoints
   GET /:project/revisions
   GET /:project/revisions/:id

The Revision Object

Attributes

id integer

Unique identifier for the revision.

activity integer

Unique identifier for the activity record.

collection string

Collection of the updated item.

item string

Primary key of updated item.

data object

Copy of item state at time of update.

delta object

Changes between the previous and the current revision.

parent_collection string

If the current item was updated relationally, this is the collection of the parent item.

parent_item string

If the current item was updated relationally, this is the unique identifier of the parent item.

parent_changed boolean

If the current item was updated relationally, this shows if the parent item was updated as well.

Revision Object
{
  "id": 1,
  "activity": 2,
  "collection": "articles",
  "item": "168",
  "data": {
    "id": "168",
    "title": "Hello, World!",
    "body": "This is my first post",
    "author": 1,
    "featured_image": 15
  },
  "delta": {
    "title": "Hello, World!"
  },
  "parent_collection": null,
  "parent_item": null,
  "parent_changed": false
}

List the Revisions

List the revisions.

Parameters

project required

The project you're targetting.

Query

fields optional

Control what fields are being returned in the object. Learn more

limit optional

A limit on the number of objects that are returned. Default is 200. Learn more

offset optional

How many items to skip when fetching data. Default is 0. Learn more

page optional

Cursor for use in pagination. Often used in combination with limit. Learn more

sort optional

How to sort the returned items. Learn more

single optional

Return the result as if it was a single item. Useful for selecting a single item based on filters and search queries. Will force limit to be 1. Learn more

filter optional

Select items in collection by given conditions. Learn more

q optional

Filter by items that contain the given search query in one of their fields. Learn more

meta optional

What metadata to return in the response. Learn more

Returns

Returns an array of revision objects.

Endpoint
   GET /:project/revisions
Response
{
  "data": [
    {
      "id": 1,
      "activity": 2,
      "collection": "articles",
      "item": "168",
      "data": {
        "id": "168",
        "title": "Hello, World!",
        "body": "This is my first post",
        "author": 1,
        "featured_image": 15
      },
      "delta": {
        "title": "Hello, World!"
      },
      "parent_collection": null,
      "parent_item": null,
      "parent_changed": false
    },
    { ... },
    { ... }
  ]
}

Retrieve a Revision

Retrieve a single revision by unique identifier.

Parameters

project required

The project you're targetting.

id required

Unique identifier of the item.

Query

fields optional

Control what fields are being returned in the object. Learn more

meta optional

What metadata to return in the response. Learn more

Returns

Returns the revision object for the given unique identifier.

Endpoint
   GET /:project/revisions/:id
Response
{
  "id": 1,
  "activity": 2,
  "collection": "articles",
  "item": "168",
  "data": {
    "id": "168",
    "title": "Hello, World!",
    "body": "This is my first post",
    "author": 1,
    "featured_image": 15
  },
  "delta": {
    "title": "Hello, World!"
  },
  "parent_collection": null,
  "parent_item": null,
  "parent_changed": false
}