Directus icon

Directus

Consume Directus API

Overview

The Directus - Collection: Update operation allows you to update the metadata of an existing collection in your Directus instance. This is useful for programmatically modifying collection-level settings, such as updating notes, descriptions, or other custom metadata fields associated with a collection.

Common scenarios:

  • Updating the description or note for a collection after initial creation.
  • Modifying custom metadata used by your application or team.
  • Automating documentation or tagging of collections as part of a workflow.

Practical example:
You have a collection called articles and want to add or update a note in its metadata to help editors understand its purpose. This node can be used in an n8n workflow to automate that update.


Properties

Name Type Meaning
Collection options Unique name of the collection to update (e.g., "articles").
Update Fields collection A set of additional fields to update. For this operation, only "Meta (JSON)" is relevant.
Meta (JSON) json Metadata object for the collection. Used to store notes or other custom information.

Output

  • The output will be a single object in the json field representing the updated collection's data as returned by the Directus API.
  • The structure typically includes all properties of the collection, including the updated meta field.

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 API will return an error.
  • Malformed JSON in Meta: If the "Meta (JSON)" field contains invalid JSON, the request will fail.
  • Insufficient Permissions: The API credentials used must have permission to update collections.

Error messages and resolutions:

  • "Collection not found": Check that the collection name is correct and exists in Directus.
  • "Invalid JSON": Ensure the "Meta (JSON)" input is valid JSON.
  • "Unauthorized" or "Forbidden": Verify that your API credentials are correct and have sufficient permissions.

Links and References

Discussion