mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Format md
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Activity',
|
||||
'description': 'All events that happen within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens.',
|
||||
'description':
|
||||
'All events that happen within Directus are tracked and stored in the activities
|
||||
collection. This gives you full accountability over everything that happens.',
|
||||
'x-collection': 'directus_activity',
|
||||
},
|
||||
}
|
||||
@@ -12,4 +14,5 @@
|
||||
|
||||
# Activity
|
||||
|
||||
All events that happen within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens.
|
||||
All events that happen within Directus are tracked and stored in the activities collection. This
|
||||
gives you full accountability over everything that happens.
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Assets',
|
||||
'description': 'Image typed files can be dynamically resized and transformed to fit any need.',
|
||||
'description':
|
||||
'Image typed files can be dynamically resized and transformed to fit any need.',
|
||||
},
|
||||
}
|
||||
---
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Authentication',
|
||||
'description': 'All events that happen within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens.',
|
||||
'description':
|
||||
'All events that happen within Directus are tracked and stored in the activities
|
||||
collection. This gives you full accountability over everything that happens.',
|
||||
},
|
||||
}
|
||||
---
|
||||
|
||||
# Authentication
|
||||
|
||||
All events that happen within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens.
|
||||
All events that happen within Directus are tracked and stored in the activities collection. This
|
||||
gives you full accountability over everything that happens.
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Collections',
|
||||
'description': 'Collections are the individual collections of items, similar to tables in a database. Changes to collections will alter the schema of the database.',
|
||||
'description':
|
||||
'Collections are the individual collections of items, similar to tables in a
|
||||
database. Changes to collections will alter the schema of the database.',
|
||||
'x-collection': 'directus_collections',
|
||||
},
|
||||
}
|
||||
@@ -12,4 +14,5 @@
|
||||
|
||||
# Collections
|
||||
|
||||
Collections are the individual collections of items, similar to tables in a database. Changes to collections will alter the schema of the database.
|
||||
Collections are the individual collections of items, similar to tables in a database. Changes to
|
||||
collections will alter the schema of the database.
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Extensions',
|
||||
'description': 'Directus can easily be extended through the addition of several types of extensions, including layouts, interfaces, and modules.',
|
||||
'description':
|
||||
'Directus can easily be extended through the addition of several types of
|
||||
extensions, including layouts, interfaces, and modules.',
|
||||
},
|
||||
}
|
||||
---
|
||||
|
||||
# Extensions
|
||||
|
||||
Directus can easily be extended through the addition of several types of extensions, including layouts, interfaces, and modules.
|
||||
Directus can easily be extended through the addition of several types of extensions, including
|
||||
layouts, interfaces, and modules.
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Fields',
|
||||
'description': 'Fields are individual pieces of content within an item. They are mapped to columns in the database.',
|
||||
'description':
|
||||
'Fields are individual pieces of content within an item. They are mapped to columns
|
||||
in the database.',
|
||||
'x-collection': 'directus_fields',
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Files',
|
||||
'description': 'Files can be saved in any given location. Directus has a powerful assets endpoint that can be used to generate thumbnails for images on the fly.',
|
||||
'description':
|
||||
'Files can be saved in any given location. Directus has a powerful assets endpoint
|
||||
that can be used to generate thumbnails for images on the fly.',
|
||||
'x-collection': 'directus_files',
|
||||
},
|
||||
}
|
||||
@@ -12,4 +14,5 @@
|
||||
|
||||
# Files
|
||||
|
||||
Files can be saved in any given location. Directus has a powerful assets endpoint that can be used to generate thumbnails for images on the fly.
|
||||
Files can be saved in any given location. Directus has a powerful assets endpoint that can be used
|
||||
to generate thumbnails for images on the fly.
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# API Reference
|
||||
|
||||
Directus offers both a RESTful and GraphQL API to manage the data in the database. The API has predictable resource-oriented URLs, relies on standard HTTP status codes, and uses JSON for input and output.
|
||||
Directus offers both a RESTful and GraphQL API to manage the data in the database. The API has
|
||||
predictable resource-oriented URLs, relies on standard HTTP status codes, and uses JSON for input
|
||||
and output.
|
||||
|
||||
The input/output of the API differs greatly for individual installs, as most of the endpoints will return data that's based on your specific schema.
|
||||
The input/output of the API differs greatly for individual installs, as most of the endpoints will
|
||||
return data that's based on your specific schema.
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Items',
|
||||
'description': 'Items are individual pieces of data in your database. They can be anything, from articles, to IoT status checks.',
|
||||
'description':
|
||||
'Items are individual pieces of data in your database. They can be anything, from
|
||||
articles, to IoT status checks.',
|
||||
},
|
||||
}
|
||||
---
|
||||
|
||||
# Items
|
||||
|
||||
Items are individual pieces of data in your database. They can be anything, from articles, to IoT status checks.
|
||||
Items are individual pieces of data in your database. They can be anything, from articles, to IoT
|
||||
status checks.
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Presets',
|
||||
'description': 'Presets hold the preferences of individual users of the platform. This allows Directus to show and maintain custom item listings for users of the app.',
|
||||
'description':
|
||||
'Presets hold the preferences of individual users of the platform. This allows
|
||||
Directus to show and maintain custom item listings for users of the app.',
|
||||
'x-collection': 'directus_presets',
|
||||
},
|
||||
}
|
||||
@@ -12,4 +14,5 @@
|
||||
|
||||
# Presets
|
||||
|
||||
Presets hold the preferences of individual users of the platform. This allows Directus to show and maintain custom item listings for users of the app.
|
||||
Presets hold the preferences of individual users of the platform. This allows Directus to show and
|
||||
maintain custom item listings for users of the app.
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Relations',
|
||||
'description': 'What data is linked to what other data. Allows you to assign authors to articles, products to sales, and whatever other structures you can think of.',
|
||||
'description':
|
||||
'What data is linked to what other data. Allows you to assign authors to articles,
|
||||
products to sales, and whatever other structures you can think of.',
|
||||
'x-collection': 'directus_relations',
|
||||
},
|
||||
}
|
||||
@@ -12,4 +14,5 @@
|
||||
|
||||
# Relations
|
||||
|
||||
What data is linked to what other data. Allows you to assign authors to articles, products to sales, and whatever other structures you can think of.
|
||||
What data is linked to what other data. Allows you to assign authors to articles, products to sales,
|
||||
and whatever other structures you can think of.
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Revisions',
|
||||
'description': "Revisions are individual changes to items made. Directus keeps track of changes made, so you're able to revert to a previous state at will.",
|
||||
'description':
|
||||
"Revisions are individual changes to items made. Directus keeps track of changes
|
||||
made, so you're able to revert to a previous state at will.",
|
||||
'x-collection': 'directus_revisions',
|
||||
},
|
||||
}
|
||||
@@ -12,4 +14,5 @@
|
||||
|
||||
# Revisions
|
||||
|
||||
Revisions are individual changes to items made. Directus keeps track of changes made, so you're able to revert to a previous state at will.
|
||||
Revisions are individual changes to items made. Directus keeps track of changes made, so you're able
|
||||
to revert to a previous state at will.
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Server',
|
||||
'description': "Access to where Directus runs. Allows you to make sure your server has everything needed to run the platform, and check what kind of latency we're dealing with.",
|
||||
'description':
|
||||
"Access to where Directus runs. Allows you to make sure your server has everything
|
||||
needed to run the platform, and check what kind of latency we're dealing with.",
|
||||
},
|
||||
}
|
||||
---
|
||||
|
||||
# Server
|
||||
|
||||
Access to where Directus runs. Allows you to make sure your server has everything needed to run the platform, and check what kind of latency we're dealing with.
|
||||
Access to where Directus runs. Allows you to make sure your server has everything needed to run the
|
||||
platform, and check what kind of latency we're dealing with.
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
'tag':
|
||||
{
|
||||
'name': 'Utilities',
|
||||
'description': 'Directus comes with various utility endpoints you can use to simplify your development flow.',
|
||||
'description':
|
||||
'Directus comes with various utility endpoints you can use to simplify your
|
||||
development flow.',
|
||||
},
|
||||
}
|
||||
---
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# Environment Variables
|
||||
|
||||
> Each Directus project supports a number of environment variables for configuration. These variables are added to the `/api/.env` file, with an example file at `/api/example.env` for easier boilerplate setup.
|
||||
|
||||
> Each Directus project supports a number of environment variables for configuration. These
|
||||
> variables are added to the `/api/.env` file, with an example file at `/api/example.env` for easier
|
||||
> boilerplate setup.
|
||||
|
||||
## General
|
||||
|
||||
@@ -15,18 +16,20 @@ URL where your API can be reached on the web.<br>**Default: `/`**
|
||||
|
||||
### `LOG_LEVEL`
|
||||
|
||||
What level of detail to log. One of `fatal`, `error`, `warn`, `info`, `debug`, `trace` or `silent`.<br>**Default: `info`**
|
||||
What level of detail to log. One of `fatal`, `error`, `warn`, `info`, `debug`, `trace` or
|
||||
`silent`.<br>**Default: `info`**
|
||||
|
||||
### `LOG_STYLE`
|
||||
|
||||
Render the logs human readable (pretty) or as JSON. One of `pretty`, `raw`.<br>**Default: `pretty`**
|
||||
|
||||
|
||||
## Database
|
||||
|
||||
### `DB_CLIENT`
|
||||
|
||||
What database client to use. One of `pg` or `postgres`, `mysql`, `mysql2`, `oracledb`, `mssql`, or `sqlite3`. For all database clients except SQLite, you will also need to configure the following variables:
|
||||
What database client to use. One of `pg` or `postgres`, `mysql`, `mysql2`, `oracledb`, `mssql`, or
|
||||
`sqlite3`. For all database clients except SQLite, you will also need to configure the following
|
||||
variables:
|
||||
|
||||
### `DB_HOST`
|
||||
|
||||
@@ -52,12 +55,11 @@ Database user's password. Required when using `pg`, `mysql`, `mysql2`, `oracledb
|
||||
|
||||
Where to read/write the SQLite database. Required when using `sqlite3`.
|
||||
|
||||
::: Additional Database Variables
|
||||
All `DB_*` environment variables are passed to the `connection` configuration of a [`Knex` instance](http://knexjs.org).
|
||||
Based on your project's needs, you can extend the `DB_*` environment variables with any config you need to pass to the database instance.
|
||||
::: Additional Database Variables All `DB_*` environment variables are passed to the `connection`
|
||||
configuration of a [`Knex` instance](http://knexjs.org). Based on your project's needs, you can
|
||||
extend the `DB_*` environment variables with any config you need to pass to the database instance.
|
||||
:::
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
### `KEY`
|
||||
@@ -74,7 +76,8 @@ The duration that the access token is valid.<br>**Default: `15m`**
|
||||
|
||||
### `REFRESH_TOKEN_TTL`
|
||||
|
||||
The duration that the refresh token is valid, and also how long users stay logged-in to the App.<br>**Default: `7d`**
|
||||
The duration that the refresh token is valid, and also how long users stay logged-in to the
|
||||
App.<br>**Default: `7d`**
|
||||
|
||||
### `REFRESH_TOKEN_COOKIE_SECURE`
|
||||
|
||||
@@ -84,7 +87,6 @@ Whether or not to use a secure cookie for the refresh token in cookie mode.<br>*
|
||||
|
||||
Value for `sameSite` in the refresh token cookie when in cookie mode.<br>**Default: `lax`**
|
||||
|
||||
|
||||
## CORS
|
||||
|
||||
### `CORS_ENABLED`
|
||||
@@ -111,7 +113,6 @@ Whether or not to send the `Access-Control-Allow-Credentials` header.<br>**Defau
|
||||
|
||||
Value for the `Access-Control-Max-Age` header.<br>**Default: `18000`**
|
||||
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
### `RATE_LIMITER_ENABLED`
|
||||
@@ -128,27 +129,28 @@ The time window in seconds in which the points are counted.<br>**Default: `1`**
|
||||
|
||||
### `RATE_LIMITER_STORE`
|
||||
|
||||
Where to store the rate limiter counts. Either `memory`, `redis`, or `memcache`. Based on the rate limiter used, you must also provide the following configurations.<br>**Default: `memory`**
|
||||
Where to store the rate limiter counts. Either `memory`, `redis`, or `memcache`. Based on the rate
|
||||
limiter used, you must also provide the following configurations.<br>**Default: `memory`**
|
||||
|
||||
* **Memory**
|
||||
* No additional configuration required
|
||||
* **Redis**
|
||||
* **`RATE_LIMITER_REDIS`** — Redis connection string
|
||||
* eg: `redis://:authpassword@127.0.0.1:6380/4`
|
||||
* Alternatively, you can enter individual connection parameters:
|
||||
* **`RATE_LIMITER_REDIS_HOST`**
|
||||
* **`RATE_LIMITER_REDIS_PORT`**
|
||||
* **`RATE_LIMITER_REDIS_PASSWORD`**
|
||||
* **`RATE_LIMITER_REDIS_DB`**
|
||||
* **Memcache**
|
||||
* **`RATE_LIMITER_MEMCACHE`** — Location of your memcache instance
|
||||
- **Memory**
|
||||
- No additional configuration required
|
||||
- **Redis**
|
||||
- **`RATE_LIMITER_REDIS`** — Redis connection string
|
||||
- eg: `redis://:authpassword@127.0.0.1:6380/4`
|
||||
- Alternatively, you can enter individual connection parameters:
|
||||
- **`RATE_LIMITER_REDIS_HOST`**
|
||||
- **`RATE_LIMITER_REDIS_PORT`**
|
||||
- **`RATE_LIMITER_REDIS_PASSWORD`**
|
||||
- **`RATE_LIMITER_REDIS_DB`**
|
||||
- **Memcache**
|
||||
- **`RATE_LIMITER_MEMCACHE`** — Location of your memcache instance
|
||||
|
||||
::: Additional Rate Limiter Variables
|
||||
All `RATE_LIMITER_*` variables are passed directly to a `rate-limiter-flexible` instance. Depending on your
|
||||
project's needs, you can extend the above environment variables to configure any of [the `rate-limiter-flexible` options](https://github.com/animir/node-rate-limiter-flexible/wiki/Options).
|
||||
::: Additional Rate Limiter Variables All `RATE_LIMITER_*` variables are passed directly to a
|
||||
`rate-limiter-flexible` instance. Depending on your project's needs, you can extend the above
|
||||
environment variables to configure any of
|
||||
[the `rate-limiter-flexible` options](https://github.com/animir/node-rate-limiter-flexible/wiki/Options).
|
||||
:::
|
||||
|
||||
|
||||
## Cache
|
||||
|
||||
### `CACHE_ENABLED`
|
||||
@@ -159,9 +161,8 @@ Whether or not caching is enabled.<br>**Default: `false`**
|
||||
|
||||
How long the cache is persisted.<br>**Default: `30m`**
|
||||
|
||||
:::warning Forced Flush
|
||||
Regardless of TTL, the cache is always flushed for every create, update, and delete action.
|
||||
:::
|
||||
:::warning Forced Flush Regardless of TTL, the cache is always flushed for every create, update, and
|
||||
delete action. :::
|
||||
|
||||
### `CACHE_NAMESPACE`
|
||||
|
||||
@@ -169,57 +170,58 @@ How to scope the cache data.<br>**Default: `directus-cache`**
|
||||
|
||||
### `CACHE_STORE`
|
||||
|
||||
Where to store the cache data. Either `memory`, `redis`, or `memcache`. Based on the cache used, you must also provide the following configurations.<br>**Default: `memory`**
|
||||
|
||||
* **Memory**
|
||||
* No additional configuration required
|
||||
* **Redis**
|
||||
* **`CACHE_REDIS`** — Redis connection string
|
||||
* eg: `redis://:authpassword@127.0.0.1:6380/4`
|
||||
* Alternatively, you can enter individual connection parameters:
|
||||
* **`CACHE_REDIS_HOST`**
|
||||
* **`CACHE_REDIS_PORT`**
|
||||
* **`CACHE_REDIS_PASSWORD`**
|
||||
* **`CACHE_REDIS_DB`**
|
||||
* **Memcache**
|
||||
* **`CACHE_MEMCACHE`** — Location of your memcache instance
|
||||
Where to store the cache data. Either `memory`, `redis`, or `memcache`. Based on the cache used, you
|
||||
must also provide the following configurations.<br>**Default: `memory`**
|
||||
|
||||
- **Memory**
|
||||
- No additional configuration required
|
||||
- **Redis**
|
||||
- **`CACHE_REDIS`** — Redis connection string
|
||||
- eg: `redis://:authpassword@127.0.0.1:6380/4`
|
||||
- Alternatively, you can enter individual connection parameters:
|
||||
- **`CACHE_REDIS_HOST`**
|
||||
- **`CACHE_REDIS_PORT`**
|
||||
- **`CACHE_REDIS_PASSWORD`**
|
||||
- **`CACHE_REDIS_DB`**
|
||||
- **Memcache**
|
||||
- **`CACHE_MEMCACHE`** — Location of your memcache instance
|
||||
|
||||
## File Storage
|
||||
|
||||
### `STORAGE_LOCATIONS`
|
||||
|
||||
A CSV of storage locations (eg: `local,digitalocean,amazon`) to use. You can use any names you'd like for these keys, but each must have a matching `<LOCATION>` configuration.<br>**Default: `local`**
|
||||
A CSV of storage locations (eg: `local,digitalocean,amazon`) to use. You can use any names you'd
|
||||
like for these keys, but each must have a matching `<LOCATION>` configuration.<br>**Default:
|
||||
`local`**
|
||||
|
||||
For each of the storage locations listed, you must provide the following configuration:
|
||||
|
||||
* **`STORAGE_<LOCATION>_PUBLIC_URL`** — Location on the internet where the files are accessible
|
||||
* **`STORAGE_<LOCATION>_DRIVER`** — Which driver to use, either `local`, `s3`, or `gcl`
|
||||
- **`STORAGE_<LOCATION>_PUBLIC_URL`** — Location on the internet where the files are accessible
|
||||
- **`STORAGE_<LOCATION>_DRIVER`** — Which driver to use, either `local`, `s3`, or `gcl`
|
||||
|
||||
Based on your configured driver, you must also provide the following configurations.
|
||||
|
||||
* **Local**
|
||||
* `STORAGE_<LOCATION>_ROOT` — Where to store the files on disk
|
||||
* **S3**
|
||||
* **`STORAGE_<LOCATION>_KEY`** — User key
|
||||
* **`STORAGE_<LOCATION>_SECRET`** — User secret
|
||||
* **`STORAGE_<LOCATION>_ENDPOINT`** — S3 Endpoint
|
||||
* **`STORAGE_<LOCATION>_BUCKET`** — S3 Bucket
|
||||
* **`STORAGE_<LOCATION>_REGION`** — S3 Region
|
||||
* **Google Cloud**
|
||||
* **`STORAGE_<LOCATION>_KEY_FILENAME`** — Path to key file on disk
|
||||
* **`STORAGE_<LOCATION>_BUCKET`** — Google Cloud Storage bucket
|
||||
|
||||
- **Local**
|
||||
- `STORAGE_<LOCATION>_ROOT` — Where to store the files on disk
|
||||
- **S3**
|
||||
- **`STORAGE_<LOCATION>_KEY`** — User key
|
||||
- **`STORAGE_<LOCATION>_SECRET`** — User secret
|
||||
- **`STORAGE_<LOCATION>_ENDPOINT`** — S3 Endpoint
|
||||
- **`STORAGE_<LOCATION>_BUCKET`** — S3 Bucket
|
||||
- **`STORAGE_<LOCATION>_REGION`** — S3 Region
|
||||
- **Google Cloud**
|
||||
- **`STORAGE_<LOCATION>_KEY_FILENAME`** — Path to key file on disk
|
||||
- **`STORAGE_<LOCATION>_BUCKET`** — Google Cloud Storage bucket
|
||||
|
||||
## oAuth
|
||||
|
||||
### `OAUTH_PROVIDERS`
|
||||
|
||||
CSV of oAuth providers you want to use. For each of the oAuth providers you list, you must also provide the following configurations.
|
||||
|
||||
* **`OAUTH_<PROVIDER>_KEY`** — oAuth key for the external service
|
||||
* **`OAUTH_<PROVIDER>_SECRET`** — oAuth secret for the external service.
|
||||
CSV of oAuth providers you want to use. For each of the oAuth providers you list, you must also
|
||||
provide the following configurations.
|
||||
|
||||
- **`OAUTH_<PROVIDER>_KEY`** — oAuth key for the external service
|
||||
- **`OAUTH_<PROVIDER>_SECRET`** — oAuth secret for the external service.
|
||||
|
||||
## Extensions
|
||||
|
||||
@@ -227,7 +229,6 @@ CSV of oAuth providers you want to use. For each of the oAuth providers you list
|
||||
|
||||
Path to your local extensions folder.<br>**Default: `./extensions`**
|
||||
|
||||
|
||||
## Email
|
||||
|
||||
### `EMAIL_FROM`
|
||||
@@ -236,15 +237,17 @@ Email address from which emails are sent.<br>**Default: `no-reply@directus.io`**
|
||||
|
||||
### `EMAIL_TRANSPORT`
|
||||
|
||||
What to use to send emails. One of `sendmail`, `smtp`. Based on the transport used, you must also provide the following configurations.<br>**Default: `sendmail`**
|
||||
What to use to send emails. One of `sendmail`, `smtp`. Based on the transport used, you must also
|
||||
provide the following configurations.<br>**Default: `sendmail`**
|
||||
|
||||
* **Sendmail** (`sendmail`)
|
||||
* **`EMAIL_SENDMAIL_NEW_LINE`** — What new line style to use in sendmail. **Default: `unix`**
|
||||
* **`EMAIL_SENDMAIL_PATH`** — Path to your sendmail executable. **Default: `/usr/sbin/sendmail`**
|
||||
* **SMTP** (`smtp`)
|
||||
* **`EMAIL_SMTP_HOST`** — SMTP Host
|
||||
* **`EMAIL_SMTP_PORT`** — SMTP Port
|
||||
* **`EMAIL_SMTP_USER`** — SMTP User
|
||||
* **`EMAIL_SMTP_PASSWORD`** — SMTP Password
|
||||
* **`EMAIL_SMTP_POOL`** — Use SMTP pooling
|
||||
* **`EMAIL_SMTP_SECURE`** — Enable TLS
|
||||
- **Sendmail** (`sendmail`)
|
||||
- **`EMAIL_SENDMAIL_NEW_LINE`** — What new line style to use in sendmail. **Default: `unix`**
|
||||
- **`EMAIL_SENDMAIL_PATH`** — Path to your sendmail executable. **Default:
|
||||
`/usr/sbin/sendmail`**
|
||||
- **SMTP** (`smtp`)
|
||||
- **`EMAIL_SMTP_HOST`** — SMTP Host
|
||||
- **`EMAIL_SMTP_PORT`** — SMTP Port
|
||||
- **`EMAIL_SMTP_USER`** — SMTP User
|
||||
- **`EMAIL_SMTP_PASSWORD`** — SMTP Password
|
||||
- **`EMAIL_SMTP_POOL`** — Use SMTP pooling
|
||||
- **`EMAIL_SMTP_SECURE`** — Enable TLS
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Error Codes
|
||||
|
||||
| Error Code | Description |
|
||||
|-----------------------|------------------------------------------------|
|
||||
| --------------------- | ---------------------------------------------- |
|
||||
| `FAILED_VALIDATION` | Validation for this particular item failed |
|
||||
| `FORBIDDEN` | You are not allowed to do the current action |
|
||||
| `INVALID_CREDENTIALS` | Username / password or access token is wrong |
|
||||
@@ -12,6 +12,5 @@
|
||||
| `ROUTE_NOT_FOUND` | Endpoint does not exist |
|
||||
| `SERVICE_UNAVAILABLE` | Could not use external service |
|
||||
|
||||
:::warning Security
|
||||
To prevent leaking which items exist, all actions for non-existing items will return a `FORBIDDEN` error.
|
||||
:::
|
||||
:::warning Security To prevent leaking which items exist, all actions for non-existing items will
|
||||
return a `FORBIDDEN` error. :::
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# Filter Rules
|
||||
|
||||
> Permissions, validation, and the API's `filter` parameter all rely on a specific JSON structure to define their rules. This page describes the syntax for creating flat, relational, or complex filter rules.
|
||||
> Permissions, validation, and the API's `filter` parameter all rely on a specific JSON structure to
|
||||
> define their rules. This page describes the syntax for creating flat, relational, or complex
|
||||
> filter rules.
|
||||
|
||||
## Syntax
|
||||
|
||||
* **Field** — Any valid root field, [relational field](#), or [logical operator](#)
|
||||
* **Operator** — Any valid [API operator](#) prefaced with an underscore
|
||||
* **Value** — Any valid static value, or [dynamic variable](#)
|
||||
- **Field** — Any valid root field, [relational field](#), or [logical operator](#)
|
||||
- **Operator** — Any valid [API operator](#) prefaced with an underscore
|
||||
- **Value** — Any valid static value, or [dynamic variable](#)
|
||||
|
||||
```
|
||||
{
|
||||
@@ -44,33 +46,34 @@
|
||||
|
||||
## Supported 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`, `like` | Contains the substring |
|
||||
| `ncontains`, `nlike` | Doesn't contain the substring |
|
||||
| `rlike` | Contains a substring using a wildcard |
|
||||
| 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`, `like` | Contains the substring |
|
||||
| `ncontains`, `nlike` | 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 |
|
||||
| `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 |
|
||||
|
||||
## Relational
|
||||
|
||||
You can target related values by nesting field names. For example, if you have a relational [Many-to-One](#)
|
||||
`author` field, you can set a rule for the `author.name` field using the following syntax.
|
||||
You can target related values by nesting field names. For example, if you have a relational
|
||||
[Many-to-One](#) `author` field, you can set a rule for the `author.name` field using the following
|
||||
syntax.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -84,52 +87,49 @@ You can target related values by nesting field names. For example, if you have a
|
||||
|
||||
## Logical Operators
|
||||
|
||||
You can nest or group multiple rules using the `_and` or `_or` logical operators. Each operator holds an array of rules, allowing for more complex filtering.
|
||||
You can nest or group multiple rules using the `_and` or `_or` logical operators. Each operator
|
||||
holds an array of rules, allowing for more complex filtering.
|
||||
|
||||
```json
|
||||
{
|
||||
"_or": [
|
||||
{
|
||||
"_and": [
|
||||
{
|
||||
"owner": {
|
||||
"_eq": "$CURRENT_USER"
|
||||
}
|
||||
},
|
||||
{
|
||||
"status": {
|
||||
"_in": [
|
||||
"published",
|
||||
"draft"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_and": [
|
||||
{
|
||||
"owner": {
|
||||
"_neq": "$CURRENT_USER"
|
||||
}
|
||||
},
|
||||
{
|
||||
"status": {
|
||||
"_in": [
|
||||
"published"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"_or": [
|
||||
{
|
||||
"_and": [
|
||||
{
|
||||
"owner": {
|
||||
"_eq": "$CURRENT_USER"
|
||||
}
|
||||
},
|
||||
{
|
||||
"status": {
|
||||
"_in": ["published", "draft"]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_and": [
|
||||
{
|
||||
"owner": {
|
||||
"_neq": "$CURRENT_USER"
|
||||
}
|
||||
},
|
||||
{
|
||||
"status": {
|
||||
"_in": ["published"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Dynamic Variables
|
||||
|
||||
In addition to static values, you can also filter against _dynamic_ values using the following variables.
|
||||
In addition to static values, you can also filter against _dynamic_ values using the following
|
||||
variables.
|
||||
|
||||
* `$CURRENT_USER` — The primary key of the currently authenticated user
|
||||
* `$CURRENT_ROLE` — The primary key of the role for the currently authenticated user
|
||||
* `$NOW` — The current timestamp
|
||||
- `$CURRENT_USER` — The primary key of the currently authenticated user
|
||||
- `$CURRENT_ROLE` — The primary key of the role for the currently authenticated user
|
||||
- `$NOW` — The current timestamp
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
## Syntax
|
||||
|
||||
* **Field** — Any valid root field or [relational field](#)
|
||||
* **Value** — Any valid static value, or [dynamic variable](#)
|
||||
- **Field** — Any valid root field or [relational field](#)
|
||||
- **Value** — Any valid static value, or [dynamic variable](#)
|
||||
|
||||
```
|
||||
{
|
||||
@@ -23,8 +23,9 @@
|
||||
|
||||
## Relational
|
||||
|
||||
You can set related values by nesting field names. For example, if you have a relational [Many-to-One](#)
|
||||
`author` field, you can set a rule for the `author.name` field using the following syntax.
|
||||
You can set related values by nesting field names. For example, if you have a relational
|
||||
[Many-to-One](#) `author` field, you can set a rule for the `author.name` field using the following
|
||||
syntax.
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -38,6 +39,6 @@ You can set related values by nesting field names. For example, if you have a re
|
||||
|
||||
In addition to static values, you can also set _dynamic_ values using the following variables.
|
||||
|
||||
* `$CURRENT_USER` — The primary key of the currently authenticated user
|
||||
* `$CURRENT_ROLE` — The primary key of the role for the currently authenticated user
|
||||
* `$NOW` — The current timestamp
|
||||
- `$CURRENT_USER` — The primary key of the currently authenticated user
|
||||
- `$CURRENT_ROLE` — The primary key of the role for the currently authenticated user
|
||||
- `$NOW` — The current timestamp
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# SDK JS
|
||||
|
||||
The JS SDK is a small wrapper around [Axios](https://npmjs.com/axios) that makes it a little easier to use the Directus API from a JavaScript powered project.
|
||||
The JS SDK is a small wrapper around [Axios](https://npmjs.com/axios) that makes it a little easier
|
||||
to use the Directus API from a JavaScript powered project.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -56,7 +57,7 @@ const directus = new DirectusSDK('https://api.example.com/', {
|
||||
storage: new MemoryStore(), // Storage adapter where refresh tokens are stored in JSON mode
|
||||
mode: 'json', // What login mode to use. One of `json`, `cookie`
|
||||
autoRefresh: true, // Whether or not to automatically refresh the access token on login
|
||||
}
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
@@ -85,18 +86,19 @@ You can tap into the Axios instance used directly through `directus.axios`.
|
||||
|
||||
```js
|
||||
directus.items('articles').create({
|
||||
title: 'My New Article'
|
||||
title: 'My New Article',
|
||||
});
|
||||
```
|
||||
|
||||
##### Multiple Items
|
||||
|
||||
```js
|
||||
directus.items('articles').create([
|
||||
{
|
||||
title: 'My First Article'
|
||||
title: 'My First Article',
|
||||
},
|
||||
{
|
||||
title: 'My Second Article'
|
||||
title: 'My Second Article',
|
||||
},
|
||||
]);
|
||||
```
|
||||
@@ -116,9 +118,9 @@ directus.items('articles').read({
|
||||
search: 'Directus',
|
||||
filter: {
|
||||
date_published: {
|
||||
_gte: '$NOW'
|
||||
}
|
||||
}
|
||||
_gte: '$NOW',
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
@@ -149,29 +151,21 @@ directus.items('articles').read([15, 42], { fields: ['title'] });
|
||||
```js
|
||||
// One
|
||||
directus.items('articles').update(15, {
|
||||
title: 'An Updated title'
|
||||
title: 'An Updated title',
|
||||
});
|
||||
|
||||
// Multiple
|
||||
directus.items('articles').update([15, 42], {
|
||||
title: 'An Updated title'
|
||||
title: 'An Updated title',
|
||||
});
|
||||
```
|
||||
|
||||
Supports optional query:
|
||||
|
||||
```js
|
||||
directus.items('articles').update(
|
||||
15,
|
||||
{ title: 'An Updated title' },
|
||||
{ fields: ['title'] }
|
||||
);
|
||||
directus.items('articles').update(15, { title: 'An Updated title' }, { fields: ['title'] });
|
||||
|
||||
directus.items('articles').update(
|
||||
[15, 42],
|
||||
{ title: 'An Updated title' },
|
||||
{ fields: ['title'] }
|
||||
);
|
||||
directus.items('articles').update([15, 42], { title: 'An Updated title' }, { fields: ['title'] });
|
||||
```
|
||||
|
||||
##### Multiple Items, Multiple Values
|
||||
@@ -192,16 +186,19 @@ directus.items('articles').update([
|
||||
Supports optional query:
|
||||
|
||||
```js
|
||||
directus.items('articles').update([
|
||||
{
|
||||
id: 15,
|
||||
title: 'Article 15',
|
||||
},
|
||||
{
|
||||
id: 42,
|
||||
title: 'Article 42',
|
||||
},
|
||||
], { fields: ['title'] });
|
||||
directus.items('articles').update(
|
||||
[
|
||||
{
|
||||
id: 15,
|
||||
title: 'Article 15',
|
||||
},
|
||||
{
|
||||
id: 42,
|
||||
title: 'Article 42',
|
||||
},
|
||||
],
|
||||
{ fields: ['title'] }
|
||||
);
|
||||
```
|
||||
|
||||
##### Multiple Items by Query, Single Value
|
||||
@@ -209,14 +206,14 @@ directus.items('articles').update([
|
||||
```js
|
||||
directus.items('articles').update(
|
||||
{
|
||||
archived: true
|
||||
archived: true,
|
||||
},
|
||||
{
|
||||
filter: {
|
||||
publish_date: {
|
||||
_gte: '$NOW'
|
||||
}
|
||||
}
|
||||
_gte: '$NOW',
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
```
|
||||
@@ -249,9 +246,9 @@ directus.activity.read();
|
||||
directus.activity.read({
|
||||
filter: {
|
||||
action: {
|
||||
_eq: 'create'
|
||||
}
|
||||
}
|
||||
_eq: 'create',
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
@@ -281,7 +278,7 @@ directus.activity.read([15, 42], { fields: ['action'] });
|
||||
directus.activity.comments.create({
|
||||
collection: 'articles',
|
||||
item: 15,
|
||||
comment: 'Hello, world!'
|
||||
comment: 'Hello, world!',
|
||||
});
|
||||
```
|
||||
|
||||
@@ -311,13 +308,19 @@ Note: these configuration options are passed in the top level SDK constructor.
|
||||
|
||||
##### mode
|
||||
|
||||
`cookie` or `json`. When in cookie mode, the API will set the refresh token in a `httpOnly` secure cookie that can't be accessed from client side JS. This is the most secure way to connect to the API from a public front-end website.
|
||||
`cookie` or `json`. When in cookie mode, the API will set the refresh token in a `httpOnly` secure
|
||||
cookie that can't be accessed from client side JS. This is the most secure way to connect to the API
|
||||
from a public front-end website.
|
||||
|
||||
When you can't rely on cookies, or need more control over handling the storage of the cookie, use `json` mode. This will return the refresh token like "regular" in the payload. You can use the `storage` option (see below) to control where the refresh token is stored / read from
|
||||
When you can't rely on cookies, or need more control over handling the storage of the cookie, use
|
||||
`json` mode. This will return the refresh token like "regular" in the payload. You can use the
|
||||
`storage` option (see below) to control where the refresh token is stored / read from
|
||||
|
||||
##### storage
|
||||
|
||||
When using `json` for mode, the refresh token needs to be stored somewhere. The `storage` option allows you to plug in any object that has an async `setItem()` and `getItem()` method. This allows you to plugin things like [`localforage`](https://github.com/localForage/localForage) directly:
|
||||
When using `json` for mode, the refresh token needs to be stored somewhere. The `storage` option
|
||||
allows you to plug in any object that has an async `setItem()` and `getItem()` method. This allows
|
||||
you to plugin things like [`localforage`](https://github.com/localForage/localForage) directly:
|
||||
|
||||
```js
|
||||
import localforage from 'localforage';
|
||||
@@ -328,7 +331,8 @@ const directus = new DirectusSDK('https://api.example.com', { storage: localfora
|
||||
|
||||
##### autoRefresh
|
||||
|
||||
Whether or not to automatically call `refresh()` when the access token is about to expire. Defaults to `true`
|
||||
Whether or not to automatically call `refresh()` when the access token is about to expire. Defaults
|
||||
to `true`
|
||||
|
||||
#### Get / Set Token
|
||||
|
||||
@@ -473,7 +477,7 @@ directus.server.specs.oas();
|
||||
#### Ping the Server
|
||||
|
||||
```js
|
||||
directus.server.ping()
|
||||
directus.server.ping();
|
||||
```
|
||||
|
||||
#### Get Server/Project Info
|
||||
@@ -540,7 +544,7 @@ Supports optional query:
|
||||
|
||||
```js
|
||||
directus.users.me.read({
|
||||
fields: ['last_access']
|
||||
fields: ['last_access'],
|
||||
});
|
||||
```
|
||||
|
||||
@@ -553,10 +557,7 @@ directus.users.me.update({ first_name: 'Admin' });
|
||||
Supports optional query:
|
||||
|
||||
```js
|
||||
directus.users.me.update(
|
||||
{ first_name: 'Admin' },
|
||||
{ fields: ['last_access'] }
|
||||
);
|
||||
directus.users.me.update({ first_name: 'Admin' }, { fields: ['last_access'] });
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user