Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

This n8n node is designed to interact with a Directus v1 API, specifically to list the fields (schema columns) of a specified collection. It is useful in scenarios where you need to dynamically retrieve and process metadata about collections in your Directus instance, such as for building dynamic forms, validating data, or automating schema documentation.

Practical examples:

  • Fetching all fields of an "articles" collection to generate a form.
  • Integrating with other systems that require knowledge of available fields in a collection.
  • Automating workflows that depend on schema changes in Directus.

Properties

Name Type Meaning
Collection Name options The name of the Directus collection whose fields you want to list. Required.
Split Into Items boolean Whether to output each field as a separate item (true), or return all in one array (false).

Output

  • If Split Into Items is false:
    The node outputs a single item with a json property containing an array of field objects, each representing a field in the selected collection.

  • If Split Into Items is true:
    The node outputs multiple items, each with a json property containing a single field object from the selected collection.

Example output when Split Into Items is false:

{
  "fields": [
    {
      "field": "id",
      "type": "integer",
      "primary_key": true,
      ...
    },
    {
      "field": "title",
      "type": "string",
      ...
    }
    // More fields...
  ]
}

Example output when Split Into Items is true:

{
  "field": "id",
  "type": "integer",
  "primary_key": true,
  ...
}

(Each item represents a single field.)

Dependencies

  • Requires access to a Directus v1 API endpoint.
  • May require authentication credentials (API key, username/password, etc.) depending on your Directus setup.
  • n8n must be configured with network access to the Directus server.

Troubleshooting

  • Invalid Collection Name:
    If the specified collection does not exist, the node may throw an error indicating the collection was not found. Double-check the collection name using the dropdown or Directus admin panel.

  • Authentication Errors:
    If credentials are missing or incorrect, you may see errors related to unauthorized access. Ensure your n8n credentials for Directus are set up correctly.

  • Network Issues:
    Errors like "ECONNREFUSED" or timeouts indicate connectivity problems between n8n and the Directus server.

Links and References

Discussion