Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Folders → Update Multiple operation in this n8n node allows you to update multiple folder records at once in a Directus instance. This is particularly useful when you need to modify properties (such as parent folder, name, or other metadata) for several folders in bulk, rather than updating each one individually.

Common scenarios:

  • Moving multiple folders under a new parent.
  • Bulk-updating custom metadata fields on folders.
  • Automating organizational changes in your file structure.

Practical example:
Suppose you want to move several folders to a new parent folder. You can provide their IDs and the new parent ID in a single request, and all specified folders will be updated accordingly.


Properties

Name Type Meaning
Data (JSON) json A JSON object specifying which folders to update (keys) and what data to update (data). See below.

Details for "Data (JSON)":

  • keys: An array of folder IDs to update.
  • data: An object containing the folder properties to update (e.g., parent, name, etc.).
  • Example:
    {
      "keys": ["fac21847-d5ce-4e4b-a288-9abafbdfbc87", "a5bdb793-dd85-4ac9-882a-b42862092983"],
      "data": {
        "parent": "d97c2e0e-293d-4eb5-9e1c-27d3460ad29d"
      }
    }
    

Output

  • The output is a json field containing the result of the update operation from Directus.
  • The structure typically reflects the updated folder objects or a summary of the update operation, depending on the Directus API response.
  • If an error occurs and "Continue On Fail" is enabled, the output will contain an error property with the error message.

Example output:

{
  "json": {
    "data": [
      {
        "id": "fac21847-d5ce-4e4b-a288-9abafbdfbc87",
        "parent": "d97c2e0e-293d-4eb5-9e1c-27d3460ad29d",
        ...
      },
      {
        "id": "a5bdb793-dd85-4ac9-882a-b42862092983",
        "parent": "d97c2e0e-293d-4eb5-9e1c-27d3460ad29d",
        ...
      }
    ]
  }
}

Note: The actual fields returned depend on your Directus configuration.


Dependencies

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

Troubleshooting

Common issues:

  • Invalid folder IDs: If any ID in keys does not exist, the API may return an error.
  • Malformed JSON: Ensure the "Data (JSON)" property is valid JSON; otherwise, parsing errors will occur.
  • Insufficient permissions: The API user must have permission to update the specified folders.
  • Partial updates: If some folders cannot be updated (e.g., due to permissions), only a subset may be changed, or an error may be thrown.

Error messages:

  • "Unexpected token ... in JSON": Indicates invalid JSON syntax in the input.
  • "Request failed with status code 403": Permission denied—check your Directus user role.
  • "Not found": One or more folder IDs do not exist.

Links and References


Discussion