Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

This n8n node is designed to interact with a "Relation" resource, specifically performing the "Get" operation. It retrieves information about a relational field within a specified collection—typically used in database or headless CMS scenarios (such as Directus). This is useful when you need to programmatically inspect or utilize relationships between collections (tables), for example, to understand how data entities are linked (e.g., which field in "books" refers to an "author").

Practical examples:

  • Fetching metadata about the relationship between "books" and "authors" in a content management system.
  • Dynamically building workflows that depend on the structure of your data model.

Properties

Name Meaning
Collection Name Unique name of the parent collection. Options are dynamically loaded (e.g., "books").
Field Name Name of the field that holds the related primary key. Options depend on the selected collection (e.g., "author").

Output

The node outputs a JSON object containing details about the specified relation field in the chosen collection. The exact structure depends on the underlying API but typically includes metadata such as:

  • The type of relation (e.g., one-to-many, many-to-one)
  • The related collection and field
  • Additional configuration or constraints

Example output (structure may vary):

{
  "collection": "books",
  "field": "author",
  "related_collection": "authors",
  "type": "many_to_one",
  "meta": {
    "onDelete": "SET NULL"
  }
}

Dependencies

  • Requires access to the backend service (such as Directus) where collections and relations are defined.
  • May require authentication (API key, credentials) depending on the service configuration.
  • n8n must be configured with the appropriate credentials for the target service.

Troubleshooting

  • Missing or incorrect options: If "Collection Name" or "Field Name" options do not appear, ensure the node can connect to the backend service and that you have sufficient permissions.
  • Invalid collection/field: Selecting a non-existent collection or field will result in errors from the backend API.
  • Authentication errors: If credentials are missing or invalid, the node may fail to load options or execute the operation.

Links and References

Discussion