diff --git a/content/guides/04.connect/3.query-parameters.md b/content/guides/04.connect/3.query-parameters.md index 7ee7b17e..b8914e5a 100644 --- a/content/guides/04.connect/3.query-parameters.md +++ b/content/guides/04.connect/3.query-parameters.md @@ -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. @@ -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. @@ -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] @@ -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 +``` + +::