Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions content/guides/04.connect/3.query-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,20 @@ Saves the API response to a file. Valid values are `csv`, `json`, `xml`, `yaml`.

## Version

Queries a version of a record by version key when [content versioning](/guides/content/content-versioning) is enabled on a collection. Applies only to single item retrieval.
Queries a version of a record by version key when [content versioning](/guides/content/content-versioning) is enabled on a collection.

```http [GET /items/posts/1]
?version=v1
```http
GET /items/posts?version=v1
GET /items/posts/1?version=v1
```

```graphql [GraphQL]
query {
posts(version: "v1") {
id
}
}

query {
posts_by_id(id: 1, version: "v1") {
id
Expand All @@ -554,15 +561,25 @@ import { createDirectus, rest, readItem } from "@directus/sdk";
const directus = createDirectus("https://directus.example.com").with(rest());

const result = await directus.request(
readItems("posts", {
version: "v1",
})
);

const item = await directus.request(
readItem("posts", {
version: "v1",
})
);
```

### Version Meta

When retrieving a versioned item, an additional `$meta` field is included in the response, containing metadata such as the version key, the used delta and possibly an error message if the version failed to apply.

## VersionRaw

Specifies to return relational delta changes as a [detailed output](https://directus.io/docs/guides/connect/relations#creating-updating-deleting) on a version record.
Specifies to return relational delta changes as a [detailed output](https://directus.io/docs/guides/connect/relations#creating-updating-deleting) on a version record. Applies only to single item retrieval.

```http [GET /items/posts/1]
?version=v1&versionRaw=true
Expand Down Expand Up @@ -736,4 +753,4 @@ The articles collection consists of a many-to-one relation to Users called `auth
}
```

::
::