Actions111
- Item Actions
- Webhook Actions
- Collection Actions
- File Actions
- Activity Actions
- Asset Actions
- Authentication Actions
- Extension Actions
- Field Actions
- Folder Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revision Actions
- Role Actions
- Setting Actions
- User Actions
- Utility Actions
Overview
This n8n node is designed to update a field within a specified collection in a Directus instance (Resource: Field, Operation: Update). It allows users to modify the properties of an existing field, such as its metadata, schema, or data type. This node is useful when you need to programmatically adjust the structure of your Directus collections, for example, updating field types, adding metadata, or changing validation rules.
Practical examples:
- Changing a field's data type from integer to string in a "users" collection.
- Updating the schema or meta information for a field in an "articles" collection.
- Modifying relationship fields (e.g., Many-to-One) in a collection.
Properties
| Name | Type | Meaning |
|---|---|---|
| Collection | options | The name of the collection containing the field to update. |
| Field Name | options | Unique name of the field within the collection to be updated. |
| JSON/RAW Parameters | boolean | Whether to provide body parameters as raw JSON or via the UI key-value pair interface. |
| Body Parameters | json | (Shown if JSON/RAW Parameters is true) The full set of body parameters as JSON or RAW for the update call. |
| Additional Fields | collection | (Hidden if JSON/RAW Parameters is true) Extra field properties to update, such as Meta (JSON), Schema (JSON), and Type. |
| Update Fields | collection | (Hidden if JSON/RAW Parameters is true) Same as Additional Fields; allows specifying Meta, Schema, and Type. |
Details on "Update Fields" options:
- Meta (JSON): The meta info for the field.
- Schema (JSON): The schema info for the field.
- Type: Directus-specific data type for the field (e.g., Integer, String, Boolean, etc.).
Output
The output will be a JSON object representing the updated field. Typical fields in the output may include:
{
"collection": "articles",
"field": "author",
"type": "string",
"meta": { /* ... */ },
"schema": { /* ... */ },
// ...other Directus field properties
}
- If the update is successful, the output contains the new state of the field after the update.
- No binary data is produced by this operation.
Dependencies
- Directus API: Requires access to a running Directus instance.
- Authentication: May require an API key or credentials configured in n8n for Directus.
- n8n Configuration: Proper credentials must be set up in n8n for the Directus node to connect to your Directus instance.
Troubleshooting
Common Issues:
- Invalid Collection or Field Name: Ensure that both the collection and field names exist in your Directus instance.
- Insufficient Permissions: The API user must have permission to update fields in the specified collection.
- Malformed JSON: When using JSON/RAW Parameters, ensure the JSON is valid.
- Unsupported Data Type: Make sure the selected type is supported by Directus and appropriate for the field.
Error Messages:
"Field not found": The specified field does not exist in the collection. Double-check the field name."Collection not found": The specified collection does not exist. Verify the collection name."Invalid JSON": The provided JSON in body parameters is malformed. Use a JSON validator."Permission denied": The API credentials lack sufficient rights. Check user roles and permissions in Directus.