Versions
List Content Versions
List all content versions that exist in Directus.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
How many items to skip when fetching data.
What metadata to return in the response.
How to sort the returned items. sort is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (-) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
Responses
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
The current changes compared to the main version of the item.
Returns the total item count of the collection you're querying.
Returns the item count of the collection you're querying, taking the current filter/search parameters into account.
import { createDirectus, rest, readContentVersions } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(readContentVersions(query_object));
{
"data": [
{
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"key": "draft",
"name": "My Draft",
"collection": "articles",
"item": "168",
"date_created": "2022-05-11T13:14:52Z",
"date_updated": "2022-05-11T13:14:53Z",
"user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
"user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
"delta": {}
}
],
"meta": {}
}Create Multiple Content Versions
Create multiple new content versions.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
What metadata to return in the response.
How many items to skip when fetching data.
How to sort the returned items. sort is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (-) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
Request Body
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
The current changes compared to the main version of the item.
Responses
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
The current changes compared to the main version of the item.
Returns the total item count of the collection you're querying.
Returns the item count of the collection you're querying, taking the current filter/search parameters into account.
import { createDirectus, rest, updateContentVersions } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(updateContentVersions(content_version_id_array, partial_content_version_object));
{
"data": [
{
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"key": "draft",
"name": "My Draft",
"collection": "articles",
"item": "168",
"date_created": "2022-05-11T13:14:52Z",
"date_updated": "2022-05-11T13:14:53Z",
"user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
"user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
"delta": {}
}
],
"meta": {}
}Delete Multiple Content Versions
Delete multiple existing content versions.
Responses
import { createDirectus, rest, deleteContentVersions } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(deleteContentVersions(content_version_id_array));
Update Multiple Content Versions
Update multiple content versions at the same time.
Query Parameters
Control what fields are being returned in the object.
A limit on the number of objects that are returned.
What metadata to return in the response.
How many items to skip when fetching data.
How to sort the returned items. sort is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (-) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV.
Select items in collection by given conditions.
Filter by items that contain the given search query in one of their fields.
Request Body
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
Responses
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
The current changes compared to the main version of the item.
Returns the total item count of the collection you're querying.
Returns the item count of the collection you're querying, taking the current filter/search parameters into account.
import { createDirectus, rest, updateContentVersions } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(updateContentVersions(content_version_id_array, partial_content_version_object));
{
"data": [
{
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"key": "draft",
"name": "My Draft",
"collection": "articles",
"item": "168",
"date_created": "2022-05-11T13:14:52Z",
"date_updated": "2022-05-11T13:14:53Z",
"user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
"user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
"delta": {}
}
],
"meta": {}
}Create a Content Version
Create a new content version for an item.
Query Parameters
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
Responses
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
import { createDirectus, rest, createContentVersion } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(createContentVersion(content_version_object));
{
"data": {
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"key": "draft",
"name": "My Draft",
"collection": "articles",
"item": "168",
"date_created": "2022-05-11T13:14:52Z",
"date_updated": "2022-05-11T13:14:53Z",
"user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
"user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
"delta": {}
}
}Retrieve a Content Version
Retrieve a single content version by unique identifier.
Query Parameters
Unique identifier for the object.
Control what fields are being returned in the object.
What metadata to return in the response.
Responses
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
import { createDirectus, rest, readContentVersion } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(readContentVersion(content_version_id, query_object));
{
"data": {
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"key": "draft",
"name": "My Draft",
"collection": "articles",
"item": "168",
"date_created": "2022-05-11T13:14:52Z",
"date_updated": "2022-05-11T13:14:53Z",
"user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
"user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
"delta": {}
}
}Delete a Content Version
Delete an existing content version.
Query Parameters
Unique identifier for the object.
Responses
import { createDirectus, rest, deleteContentVersion } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(deleteContentVersion(content_version_id));
Update a Content Version
Update an existing content version.
Query Parameters
Unique identifier for the object.
Control what fields are being returned in the object.
What metadata to return in the response.
Request Body
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
Responses
Primary key of the Content Version.
Key of the Content Version, used as the value for the "version" query parameter.
Descriptive name of the Content Version.
Name of the collection the Content Version is created on.
The item the Content Version is created on. Many-to-one to items.
When the Content Version was created.
When the Content Version was updated.
User that created the Content Version. Many-to-one to users.
User that updated the Content Version. Many-to-one to users.
import { createDirectus, rest, updateContentVersion } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(updateContentVersion(content_version_id, partial_content_version_object));
{
"data": {
"id": "63716273-0f29-4648-8a2a-2af2948f6f78",
"key": "draft",
"name": "My Draft",
"collection": "articles",
"item": "168",
"date_created": "2022-05-11T13:14:52Z",
"date_updated": "2022-05-11T13:14:53Z",
"user_created": "63716273-0f29-4648-8a2a-2af2948f6f78",
"user_updated": "63716273-0f29-4648-8a2a-2af2948f6f78",
"delta": {}
}
}Compare a Content Version
Compare an existing content version with the main version of the item.
Query Parameters
Unique identifier for the object.
Responses
import { createDirectus, rest, compareContentVersion } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(compareContentVersion(content_version_id));
{
"data": {}
}Promote a Content Version
Promote an existing content version to become the new main version of the item.
Query Parameters
Unique identifier for the object.
Request Body
Hash of the main version of the item to be promoted.
Optional array of field names of which the values are to be promoted.
Responses
The primary key of the promoted item.
import { createDirectus, rest, promoteContentVersion } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(promoteContentVersion(content_version_id, promote_object));
Save to a Content Version
Save item changes to an existing content version.
Query Parameters
Unique identifier for the object.
Responses
import { createDirectus, rest, saveToContentVersion } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(saveToContentVersion(content_version_id, partial_item_object));
{
"data": {}
}