Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

This n8n node allows you to update an existing item in a specified collection within a Directus instance. It is useful when you need to modify the data of a particular record, such as updating article content, changing user information, or altering any resource managed by Directus.

Common scenarios:

  • Updating the title and body of an article in a CMS.
  • Modifying user profile details.
  • Changing metadata for files or other resources.

Practical example:
You have an "articles" collection and want to update the title and body of the article with ID 15.

Properties

Name Meaning
ID Unique ID of the file object. This identifies which item in the collection will be updated.
Collection Name Unique name of the parent collection. Choose from available collections (e.g., articles, users, etc.).
Data (JSON) The partial item object. Provide the fields and values to update in JSON format. Example:
{
"title": "Hello world!",
"body": "This is our first article"
}

Output

The output will be a json field containing the updated item object as returned by Directus. The structure will match the fields of the item in the specified collection, including any updated values.

Example:

{
  "id": 15,
  "title": "Hello world!",
  "body": "This is our first article",
  // ...other fields present in the collection
}

Dependencies

  • Requires access to a Directus instance.
  • May require API credentials or authentication configured in n8n.
  • The node relies on the Directus API being reachable from the n8n environment.

Troubleshooting

Common issues:

  • Invalid ID: If the provided ID does not exist in the specified collection, the update will fail.
  • Missing required fields: If the collection has required fields that are not included in the update, Directus may return an error.
  • Authentication errors: If API credentials are missing or incorrect, the node will not be able to connect to Directus.

Error messages and resolutions:

  • "Item not found": Ensure the ID and Collection Name are correct.
  • "Unauthorized": Check your API credentials and permissions.
  • "Validation failed": Make sure the JSON data matches the schema of the collection.

Links and References

Discussion