Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus - Preset: Create operation in this n8n node allows you to create a new "Preset" object in your Directus instance. Presets in Directus are used to store user interface preferences, such as default filters, layouts, and search queries for collections or users. This node is useful when you want to automate the setup of user or collection views, streamline onboarding, or programmatically manage UI configurations.
Practical examples:
- Automatically assign a default layout and filter for new users.
- Batch-create presets for multiple collections during project initialization.
- Set up custom search defaults for specific roles or users.
Properties
Name | Type | Meaning |
---|---|---|
Data (JSON) | json | A partial preset object. This should be a JSON object containing the preset configuration, such as user ID, layout type, search query, etc. |
Output
The output will be a json
field containing the created Preset object as returned by the Directus API. The structure typically includes fields like:
{
"id": "string",
"user": "string",
"role": "string",
"collection": "string",
"layout": "string",
"search": "string",
"filters": {},
"fields": [],
"bookmark": "string",
"icon": "string",
"color": "string",
"data": {},
"sort": "string",
"hidden": false,
"readonly": false
}
Note: The actual fields depend on what you provide in the input and what Directus returns.
Dependencies
- Directus API: You must have access to a running Directus instance.
- API Credentials: The node requires valid Directus API credentials configured in n8n under the name
directusApi
.
Troubleshooting
Common issues:
- Invalid JSON: If the "Data (JSON)" property is not valid JSON, the node will throw a parsing error. Double-check your syntax.
- Missing required fields: If required fields for a preset are missing, Directus may return an error indicating which fields are needed.
- Authentication errors: Invalid or expired API credentials will result in authentication failures.
- Permission denied: The API user must have permission to create presets in Directus.
Error messages and resolutions:
"Unexpected token ... in JSON"
: Check your JSON formatting in the "Data (JSON)" field."401 Unauthorized"
: Verify your Directus API credentials in n8n."400 Bad Request"
: Review the data sent; ensure all required preset fields are included and correctly formatted.