* Simplified generics and imports for items page snippets * Simplified generics and imports for files page snippets * Fixing simplified generic snippets in items page * Simplified generics and imports for activity page snippets * Simplified generics and imports for collections page snippets * Simplified generics and imports for dashboards page snippets * Simplified generics and imports for extensions page snippets * Simplified generics and imports for fields page snippets * Simplified generics and imports for flows page snippets * Simplified generics and imports for folders page snippets * Simplified generics and imports for notifications page snippets * Simplified generics and imports for operations page snippets * Simplified generics and imports for panels page snippets * Simplified generics and imports for permissions page snippets * Simplified generics and imports for presets page snippets * Simplified generics and imports for relations page snippets * Simplified generics and imports for relations page snippets * Simplified generics and imports for revisions page snippets * Simplified generics and imports for roles page snippets * Consolidated imports for schema page snippets * Simplified generics and imports for server page snippets * Simplified generics and imports for settings page snippets * Fixed mixed up snippets and simplified generics and imports for shares page snippets * Simplified generics and imports for translation page snippets * Fixed mixed up snippets and simplified generics and imports for user page snippets * Simplified generics and imports fo uutilitie pages snippets * Simplified generics and imports for webhook pages snippets * Simplified generics and imports for authentication pages snippets * Consolidated imports for query pages sdk snippets * Format files * Update lockfile * Fix spelling * Format snippets * Aling `result` const * Small clean-ups - Align `SEARCH` snippets, move "Learn more..." next to other hint - ids -> IDs - Other alignments --------- Co-authored-by: Bevis Halsey-Perry <hi@be7.is> Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
5.6 KiB
description, readTime, pageClass
| description | readTime | pageClass |
|---|---|---|
| REST and GraphQL API documentation on the Settings collection in Directus. | 3 min read | page-reference |
Settings
Settings are key-value pairs that are stored in the database, and control different aspects of the project. Only administrators have access to manage Settings.
The Settings Object
id uuid
Primary key of the setting.
project_name string
Name of the project, shown in the Admin App.
project_descriptor string
Descriptor of the project, shown in the Admin App.
project_url string
Link to the (public) website that goes with this project.
project_color string
Brand color for the current project.
project_logo many-to-one
Primary logo for the current project. Many-to-one to files.
public_foreground many-to-one
Foreground image for the Admin App's public pages. Many-to-one to files.
public_background many-to-one
Background image for the Admin App's public pages. Many-to-one to files.
public_note string
Note shown on the Admin App's public pages. Supports Markdown.
auth_login_attempts integer
How often a user is allowed to try to login. After which times the user will be suspended.
auth_password_policy RegEx
What regex passwords must pass in order to be valid.
storage_asset_transform string
If the transform endpoints are allowed to be used on the assets endpoint. One
of all, none or presets.
storage_asset_presets array
What preset keys exist in the assets endpoint.
custom_css string
CSS rules to override the App's default styling.
storage_default_folder uuid
Folder for uploaded files. Does not affect existing files.
basemaps array
Custom tiles to overriding the Mapbox defaults.
mapbox_key string
Mapbox Access Token.
module_bar array
What modules are enabled/added globally.
custom_aspect_ratios array
Custom aspect ratios in the image editor.
{
"data": {
"id": 1,
"project_name": "Directus",
"project_descriptor": "Application",
"project_url": null,
"project_color": null,
"project_logo": null,
"public_foreground": null,
"public_background": null,
"public_note": null,
"auth_login_attempts": 25,
"auth_password_policy": null,
"storage_asset_transform": "all",
"storage_asset_presets": [
{
"key": "small",
"fit": "cover",
"width": 200,
"height": 161,
"quality": 80,
"withoutEnlargement": false
}
],
"custom_css": null,
"storage_default_folder": null,
"basemaps": null,
"mapbox_key": null,
"module_bar": null,
"custom_aspect_ratios": [
{
"text": "16:10",
"value": 1.6
}
]
}
}
Retrieve Settings
Request
GET /settings
POST /graphql/system
type Query {
settings: directus_settings
}
import { createDirectus, rest, readSettings } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(readSettings());
Query Parameters
Supports all global query parameters.
Response
Returns the settings object.
Example
GET /settings
POST /graphql/system
query {
settings {
project_name
}
}
import { createDirectus, rest, readSettings } from '@directus/sdk';
const client = createDirectus('https://directus.example.com').with(rest());
const result = await client.request(readSettings());
Update Settings
Request
PATCH /settings
Provide a partial settings object as the body of your request.
POST /graphql/system
type Mutation {
update_settings(data: update_directus_settings_input!): directus_settings
}
import { createDirectus, rest, updateSettings } from '@directus/sdk';
const client = createDirectus('directus_project_url').with(rest());
const result = await client.request(updateSettings(settings_object));
Query Parameters
Supports all global query parameters.
Request Body
A partial settings object.
Response
Returns the settings object.
Example
PATCH /settings
{
"project_url": "https://example.com/"
}
POST /graphql/system
mutation {
update_settings(data: { project_url: "https://example.com" }) {
project_name
project_url
}
}
import { createDirectus, rest, updateSettings } from '@directus/sdk';
const client = createDirectus('https://directus.example.com').with(rest());
const result = await client.request(
updateSettings({
project_url: 'https://example.com/',
})
);