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 node for n8n allows you to interact with the Directus API. Specifically, when using the Preset resource and the Create Multiple operation, this node enables you to create multiple preset objects in a single request. Presets in Directus are used to store user interface preferences, such as default filters, layouts, or search terms for collections.
Common scenarios:
- Bulk creation of UI presets for different users or collections.
- Automating onboarding by predefining views and filters for new users.
- Migrating or synchronizing preset configurations between environments.
Practical example:
You might use this operation to set up default card and table views for several collections for a group of users after a new Directus instance is deployed.
Properties
Name | Type | Meaning |
---|---|---|
Data (JSON) | json | An array of partial preset objects. Each object defines settings like collection, user, layout, and search preferences. This property is required. |
Output
- The output will be an array of JSON objects, each representing a created preset as returned by the Directus API.
- Each object contains the fields of the created preset, which may include properties such as
id
,collection
,user
,layout
,search
, and other preset-related attributes as defined by Directus. - If an error occurs and "Continue On Fail" is enabled, the output will contain an object with an
error
field describing the issue.
Example output:
[
{
"json": {
"id": 1,
"collection": "directus_files",
"user": "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca",
"layout": "cards",
"search": "Directus",
...
}
},
{
"json": {
"id": 2,
"collection": "articles",
"user": "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca",
"layout": "tabular",
...
}
}
]
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 in Data (JSON): If the input is not valid JSON, the node will throw a parsing error. Ensure your data is a properly formatted JSON array.
- Missing required fields: Each preset object should include all necessary fields as expected by Directus. Refer to the Directus Preset Object documentation.
- Permission errors: The API credentials used must have permission to create presets. Otherwise, you may receive authorization errors.
- API connection issues: Network or configuration problems can result in connection errors.
Error messages and resolutions:
"Unexpected token ..."
: Indicates malformed JSON. Double-check your input."Request failed with status code 401/403"
: Check your API credentials and permissions."Field '...' is required"
: Make sure all required preset fields are included in each object.