Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Folders → Update

AI-generated

Overview

The Folders: Update operation in this n8n node allows you to update the details of an existing folder in a Directus instance. This is useful for workflows where you need to programmatically rename folders, change their parent (for nesting), or update other folder metadata.

Common scenarios:

  • Renaming a folder based on workflow logic.
  • Moving a folder to a different parent folder.
  • Bulk updating folder properties as part of data migration or organization tasks.

Practical example:
Suppose you have a workflow that organizes uploaded files into project-specific folders. If a project's name changes, you can use this operation to automatically update the corresponding folder's name and/or move it under a new parent folder.


Properties

Name Type Meaning
ID string Unique ID of the folder object to update.
JSON/RAW Parameters boolean If enabled, body parameters are provided as raw JSON; otherwise, use UI fields below.
Body Parameters json (Shown if JSON/RAW Parameters is true) The full set of body parameters as JSON or RAW input.
Update Fields collection (Shown if JSON/RAW Parameters is false) Fields to update:
- Name: New folder name.
- Parent: ID of the new parent folder.

Output

  • The output will be a single json object representing the updated folder.
  • The structure typically includes all folder properties as returned by the Directus API, such as:
    • id: Folder ID
    • name: Folder name
    • parent: Parent folder ID (if any)
    • Other metadata fields managed by Directus

Example output:

{
  "id": "0fca80c4-d61c-4404-9fd7-6ba86b64154d",
  "name": "New Folder Name",
  "parent": "d97c2e0e-293d-4eb5-9e1c-27d3460ad29d",
  ...
}
  • No binary data is produced by this operation.

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n with appropriate permissions to update folders.

Troubleshooting

Common issues:

  • Invalid ID: If the provided folder ID does not exist, the operation will fail with an error from the Directus API.
  • Missing required fields: If required fields are omitted (e.g., ID), the node will throw an error.
  • Permission denied: If the API credentials lack permission to update folders, you'll receive an authorization error.
  • Malformed JSON: If using JSON/RAW Parameters and the JSON is invalid, the node will throw a parsing error.

Error messages and resolutions:

  • "Cannot find folder with ID ...": Check that the ID is correct and exists in your Directus instance.
  • "Permission denied": Ensure your API credentials have write access to folders.
  • "Unexpected token ... in JSON": Double-check your JSON syntax when using raw input.

Links and References

Discussion