Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Directus (DrWade) n8n node for the resource Collections with the operation Get retrieves detailed information about a specific collection from a Directus instance. This is useful when you need to programmatically access metadata or configuration details of a collection, such as its fields, settings, and other properties.

Common scenarios:

  • Automating documentation or audits of your Directus collections.
  • Dynamically adapting workflows based on collection structure.
  • Integrating collection metadata into other systems or dashboards.

Practical example:
Suppose you have a workflow that needs to validate data before inserting it into a Directus collection. You can use this node to fetch the collection's schema and ensure your data matches the expected structure.


Properties

Name Type Meaning
Collection options Unique name of the collection to retrieve.

Output

  • The output will be a single object in the json field containing all available metadata and configuration details for the specified collection.
  • The exact structure depends on the Directus API response, but typically includes:
    • collection: The collection's unique identifier.
    • meta: Metadata such as display name, icon, description, etc.
    • schema: Information about the collection's fields and types.
    • Other configuration and system properties relevant to the collection.

Example output:

{
  "collection": "articles",
  "meta": {
    "displayName": "Articles",
    "icon": "article",
    "description": "A collection of articles"
  },
  "schema": {
    // ...field definitions...
  }
  // ...other 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 provided collection name does not exist, the node will return an error.
  • Authentication Errors: Missing or incorrect API credentials will result in authentication failures.
  • Insufficient Permissions: The API user must have permission to read collection metadata.

Error messages and resolutions:

  • "Collection not found": Double-check the collection name; use the dropdown to select valid collections.
  • "Unauthorized" or "Forbidden": Ensure your API credentials are correct and have sufficient permissions.
  • "Network Error": Verify connectivity to your Directus instance.

Links and References

Discussion