mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Add missing query param docs
This commit is contained in:
@@ -38,6 +38,11 @@ const systemDefaults: Record<string, Partial<Preset>> = {
|
||||
directus_users: {
|
||||
collection: 'directus_users',
|
||||
layout: 'cards',
|
||||
layout_query: {
|
||||
cards: {
|
||||
sort: 'email',
|
||||
},
|
||||
},
|
||||
layout_options: {
|
||||
cards: {
|
||||
icon: 'account_circle',
|
||||
|
||||
3
docs/reference/api/query/download.md
Normal file
3
docs/reference/api/query/download.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Download
|
||||
|
||||
Download the generated asset as a file.
|
||||
@@ -1,3 +1,39 @@
|
||||
# Fields
|
||||
|
||||
@TODO
|
||||
`fields` is a CSV of columns to include in the result. This parameter supports dot notation to request nested relational
|
||||
fields. You can also use a wildcard (\*) to include all fields at a specific depth.
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
# Get all top-level fields
|
||||
?fields=*
|
||||
|
||||
# Get all top-level fields and all second-level relational fields
|
||||
?fields=*.*
|
||||
|
||||
# Get all top-level fields and second-level relational fields within images
|
||||
?fields=*,images.*
|
||||
|
||||
# Get only the first_name and last_name fields
|
||||
?fields=first_name,last_name
|
||||
|
||||
# Get all top-level and second-level relational fields, and third-level fields within images.thumbnails
|
||||
?fields=*.*,images.thumbnails.*
|
||||
```
|
||||
|
||||
Alternatively, you can use the array syntax to specify multiple fields:
|
||||
|
||||
```
|
||||
?fields[]=*
|
||||
&fields[]=images.*
|
||||
|
||||
|
||||
?fields[]=first_name
|
||||
&fields[]=last_name
|
||||
|
||||
|
||||
?fields[]=title
|
||||
&fields[]=images
|
||||
&fields[]=thumbnails.*
|
||||
```
|
||||
|
||||
49
docs/reference/api/query/filter.md
Normal file
49
docs/reference/api/query/filter.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Filter
|
||||
|
||||
Used to search items in a collection that matches the filter's conditions. Filters follow the syntax
|
||||
`filter[<field-name>][<operator>]=<value>`.
|
||||
|
||||
#### Filter Operators
|
||||
|
||||
| Operator | Description |
|
||||
| ------------ | ----------------------------------------- |
|
||||
| `_eq` | Equal to |
|
||||
| `_neq` | Not equal to |
|
||||
| `_lt` | Less than |
|
||||
| `_lte` | Less than or equal to |
|
||||
| `_gt` | Greater than |
|
||||
| `_gte` | Greater than or equal to |
|
||||
| `_in` | Exists in one of the values |
|
||||
| `_nin` | Not in one of the values |
|
||||
| `_null` | It is null |
|
||||
| `_nnull` | It is not null |
|
||||
| `_contains` | Contains the substring |
|
||||
| `_ncontains` | Doesn't contain the substring |
|
||||
| `_rlike` | Contains a substring using a wildcard |
|
||||
| `_nrlike` | Not contains a substring using a wildcard |
|
||||
| `_between` | The value is between two values |
|
||||
| `_nbetween` | The value is not between two values |
|
||||
| `_empty` | The value is empty (null or falsy) |
|
||||
| `_nempty` | The value is not empty (null or falsy) |
|
||||
| `_all` | Contains all given related item's IDs |
|
||||
| `_has` | Has one or more related items's IDs |
|
||||
|
||||
#### Filter: Relational
|
||||
|
||||
You can filter by relational values by appending the field names in nested sections in the parameter, as follows:
|
||||
|
||||
`?filter[author][name][_eq]=Rijk`
|
||||
|
||||
#### Filtering using JSON
|
||||
|
||||
The `filter` parameter supports the full [Filter Rules](/reference/filter-rules.html) syntax. As a matter of fact, the
|
||||
standard array-like syntax is parsed to an object in execution. This means that you can also pass filter rules as a JSON
|
||||
object in the parameter directly:
|
||||
|
||||
```
|
||||
?filter={ "status": { "_eq": "active" }}
|
||||
```
|
||||
|
||||
#### AND vs OR
|
||||
|
||||
See [Filter Rules](/reference/filter-rules.html) for more information on how to nest logical operations in a filter.
|
||||
15
docs/reference/api/query/fit.md
Normal file
15
docs/reference/api/query/fit.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Fit
|
||||
|
||||
Controls how the image is being fitted within the binding box. Can be compared to CSS' `object-fit`.
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
?fit=cover
|
||||
|
||||
?fit=contain
|
||||
|
||||
?fit=inside
|
||||
|
||||
?fit=outside
|
||||
```
|
||||
12
docs/reference/api/query/height.md
Normal file
12
docs/reference/api/query/height.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Height
|
||||
|
||||
Sets the height in pixels of the generated asset.
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
?height=500
|
||||
|
||||
?height=1080
|
||||
&width=1920
|
||||
```
|
||||
11
docs/reference/api/query/key.md
Normal file
11
docs/reference/api/query/key.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Asset Key
|
||||
|
||||
The key of the asset size configured in settings.
|
||||
|
||||
Note: you can't combine this with any of the other transformation query parameters, like `width`, `height`, or `fit`
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
/assets/b10e9716-7270-423b-b857-039b252e1408?key=system-small-cover
|
||||
```
|
||||
20
docs/reference/api/query/limit.md
Normal file
20
docs/reference/api/query/limit.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Limit
|
||||
|
||||
Using `limit` can be set the maximum number of items that will be returned. You can also use `-1` to return all items,
|
||||
bypassing the default limits. The default limit is set to 100.
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
# Returns a maximum of 10 items
|
||||
?limit=10
|
||||
|
||||
# Returns an unlimited number of items
|
||||
?limit=-1
|
||||
```
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
::: warning
|
||||
Fetching unlimited data may result in degraded performance or timeouts, use with caution.
|
||||
:::
|
||||
<!-- prettier-ignore-end -->
|
||||
16
docs/reference/api/query/meta.md
Normal file
16
docs/reference/api/query/meta.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Metadata
|
||||
|
||||
The `meta` parameter is a CSV of metadata fields to include. This parameter supports the wildcard (`*`) to return all
|
||||
metadata fields.
|
||||
|
||||
## Options
|
||||
|
||||
- `total_count` - Total number of items in this collection
|
||||
- `filter_count` - Number of items matching the filter query
|
||||
|
||||
```json
|
||||
{
|
||||
"total_count": 962,
|
||||
"filter_count": 120
|
||||
}
|
||||
```
|
||||
11
docs/reference/api/query/offset.md
Normal file
11
docs/reference/api/query/offset.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Offset
|
||||
|
||||
Using `offset` the first `offset` number of items can be skipped.
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
# Returns a maximum of 10 items, but skips the first 3 items on the list
|
||||
?offset=3
|
||||
&limit=10
|
||||
```
|
||||
3
docs/reference/api/query/quality.md
Normal file
3
docs/reference/api/query/quality.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Quality
|
||||
|
||||
Quality of the compression. 0-100
|
||||
5
docs/reference/api/query/search.md
Normal file
5
docs/reference/api/query/search.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Search
|
||||
|
||||
The `search` parameter allows you to perform a search on all string and text type fields within a collection. It's an
|
||||
easy way to search for an item without creating complex field filters – though it is far less optimized. It only
|
||||
searches the root item's fields, related item fields are not included.
|
||||
19
docs/reference/api/query/single.md
Normal file
19
docs/reference/api/query/single.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Single
|
||||
|
||||
Using `single` the first element will be returned.
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
::: tip NOTE
|
||||
Instead of returning a list, the result data will be a single object representing the first item.
|
||||
:::
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
# Returns the first item of the result set
|
||||
?single=1
|
||||
|
||||
?filter[author][first_name]=Rijk
|
||||
&single
|
||||
```
|
||||
17
docs/reference/api/query/sort.md
Normal file
17
docs/reference/api/query/sort.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Sorting
|
||||
|
||||
`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.
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
# Sorts by name ASC
|
||||
?sort=name
|
||||
|
||||
# Sorts by name ASC, followed by age DESC
|
||||
?&sort=name,-age
|
||||
|
||||
# Sorts by name ASC, followed by age DESC
|
||||
?sort=name,-age
|
||||
```
|
||||
12
docs/reference/api/query/width.md
Normal file
12
docs/reference/api/query/width.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Width
|
||||
|
||||
Sets the width in pixels of the generated asset.
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
?width=500
|
||||
|
||||
?width=1920
|
||||
&height=1080
|
||||
```
|
||||
9
docs/reference/api/query/withoutEnlargement.md
Normal file
9
docs/reference/api/query/withoutEnlargement.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Without Enlargement
|
||||
|
||||
Prevents the file from being upscaled if the dimensions are bigger than the original file.
|
||||
|
||||
## Examples
|
||||
|
||||
```
|
||||
?withoutEnlargement
|
||||
```
|
||||
Reference in New Issue
Block a user