Directus icon

Directus

Consume Directus API

Overview

The Directus - Folder: Update operation allows you to update the details of an existing folder in your Directus instance. This is useful for managing and organizing files within your Directus project, such as renaming folders or changing their parent folder to restructure your file hierarchy.

Common scenarios:

  • Renaming a folder to better reflect its contents.
  • Moving a folder into another folder (nesting).
  • Updating multiple properties of a folder at once using raw JSON input.

Practical example:
Suppose you have a folder named "2023 Reports" and want to rename it to "Annual Reports 2023" and move it under a new parent folder called "Archives". You can use this node operation to perform both actions in one step.


Properties

Name Type Meaning
ID String Unique ID of the folder object to update.
JSON/RAW Parameters Boolean If enabled, allows you to provide body parameters as raw JSON instead of using UI fields.
Body Parameters JSON (Shown if JSON/RAW Parameters is true) The full set of body parameters as JSON or RAW.
Update Fields Collection (Shown if JSON/RAW Parameters is false) Individual fields to update on the folder.
└ Name String New name for the folder. Cannot be null or empty.
└ Parent String Unique identifier of the parent folder (for nesting).

Output

  • The output will be a single json object representing the updated folder.
  • The structure of the output matches the Directus API response for a folder object, typically including fields like id, name, parent, and other folder metadata.

Example output:

{
  "id": "0fca80c4-d61c-4404-9fd7-6ba86b64154d",
  "name": "Annual Reports 2023",
  "parent": "d97c2e0e-293d-4eb5-9e1c-27d3460ad29d",
  // ...other folder fields
}

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n for authentication.

Troubleshooting

Common issues:

  • Invalid Folder ID: If the provided ID does not exist, the operation will fail with an error from the Directus API.
  • Missing Required Fields: If required fields are missing (e.g., ID), the node will throw an error.
  • Empty or Null Name: If updating the name, it cannot be null or empty.
  • Permission Denied: Ensure your API credentials have permission to update folders.

Error messages and resolutions:

  • "Cannot find folder with ID...": Double-check the folder ID.
  • "Name can't be null or empty": Provide a valid name when updating.
  • "Unauthorized" or "Forbidden": Check your API credentials and permissions.

Links and References

Discussion