Skip to content
Open
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
47 changes: 42 additions & 5 deletions content/guides/04.connect/3.query-parameters.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
stableId: 2627d8eb-784f-4197-8d66-f180347d1b4d
title: Query Parameters
description: Learn about Directus query parameters - fields, filter, search, sort, limit, offset, page, aggregate, groupBy, deep, alias, and export. Understand how to customize your API requests and retrieve specific data from your collections.
description: Learn about Directus query parameters - fields, filter, search, sort, limit, offset, page, aggregate, groupBy, deep, alias, export, version, versionRaw, backlink, and meta. Understand how to customize your API requests and retrieve specific data from your collections.
---

Most Directus API endpoints can use global query parameters to alter the data that is returned.
Expand Down Expand Up @@ -554,10 +554,15 @@ Note that it is not possible to use aliases on relational fields e.g. `alias[aut

Saves the API response to a file. Valid values are `csv`, `json`, `xml`, `yaml`.

```http [GET /items/posts]
?export=type
::code-group

```http [REST]
GET /items/posts
?export=csv
```

::

## 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.
Expand All @@ -569,8 +574,9 @@ The keys `published` and `draft` are reserved. Use `published` (or `main` for ba

::code-group

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

```graphql [GraphQL]
Expand Down Expand Up @@ -784,3 +790,34 @@ The articles collection consists of a many-to-one relation to Users called `auth
```

::

## Meta

Returns metadata about the result set alongside the requested data. Accepts `total_count`, `filter_count`, a comma-separated combination of the two, or `*` for both.

| Value | Description |
| -------------- | --------------------------------------------------------- |
| `total_count` | Total number of items in the collection, ignoring filters |
| `filter_count` | Number of items matching the current filter/search |

::code-group

```http [REST]
GET /items/posts
?meta=total_count,filter_count
```

```graphql [GraphQL]
# Not available. Use the collection's aggregated query instead:
query {
posts_aggregated {
countAll
}
}
```

```js [SDK]
// Not yet supported by the SDK: https://github.com/directus/directus/issues/22640
```

::
Loading