Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Collections → Update

AI-generated

Overview

The Directus (DrWade) n8n node for the resource Collections and operation Update allows you to update the metadata of an existing collection in your Directus instance. This is useful when you need to programmatically change properties such as the collection's description, notes, or other metadata fields.

Common scenarios:

  • Updating documentation or notes for a collection.
  • Modifying custom metadata used by your application or team.
  • Automating changes to collection settings as part of a workflow.

Practical example:
Suppose you have a collection called articles and want to update its metadata to include a new note or change its display name. You can use this node in your n8n workflow to automate that update whenever needed.


Properties

Name Type Meaning
Collection options Unique name of the collection to update. Required.
Update Fields collection A set of additional fields to update. For this operation, only "Meta (JSON)" is available.
Meta (JSON) json Metadata of the collection. Should be a JSON object with keys/values for collection meta. Optional.

Output

  • The output will be a single item with a json field containing the updated collection data as returned by the Directus API.
  • The structure of the json field matches the Directus Collection object, typically including:
    • collection: The name of the collection.
    • meta: The updated metadata object.
    • Other standard collection properties (e.g., schema, fields, etc.), depending on what the API returns.

Example output:

{
  "collection": "articles",
  "meta": {
    "note": "Short quotes from happy customers."
  },
  // ...other collection properties
}

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 Collection Name: If the specified collection does not exist, the node will throw an error.
  • Malformed JSON in Meta: If the "Meta (JSON)" field contains invalid JSON, the request will fail.
  • Insufficient Permissions: The API user must have permission to update collections; otherwise, you'll receive an authorization error.

Error messages and resolutions:

  • "Cannot find collection": Check that the collection name is correct and exists in Directus.
  • "Unexpected token" or similar JSON parse errors: Ensure the "Meta (JSON)" input is valid JSON.
  • "Unauthorized" or "Forbidden": Verify your API credentials and permissions.

Links and References

Discussion