Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Directus (DrWade) n8n node with Resource Fields and Operation Get retrieves detailed information about a specific field within a specified collection in your Directus instance. This is useful for automation scenarios where you need to inspect or utilize metadata about fields, such as their type, interface, options, or validation rules.

Common use cases:

  • Dynamically generating forms or UI elements based on field definitions.
  • Validating data before inserting or updating items in a collection.
  • Auditing or documenting the structure of collections programmatically.

Example:
You want to fetch the configuration of the "status" field in the "articles" collection to determine its allowed values and display settings.


Properties

Name Type Meaning
Field options Unique name of the field within the selected collection. Required to identify the field.
Collection options The name of the collection containing the field. Required to specify the context.

Output

The output will be a single object in the json property containing all details about the requested field. The structure typically includes:

{
  "collection": "articles",
  "field": "status",
  "type": "string",
  "interface": "select-dropdown",
  "options": { /* field-specific options */ },
  "schema": { /* database schema info */ },
  "meta": { /* display name, translations, etc. */ },
  // ...other field properties
}
  • collection: Name of the collection the field belongs to.
  • field: Field's unique identifier.
  • type: Data type (e.g., string, integer).
  • interface: UI component used in Directus admin.
  • options: Configuration options for the field/interface.
  • schema: Database-level schema details.
  • meta: Metadata such as display name, translations, notes, etc.

Note: The exact structure may vary depending on your Directus version and field configuration.


Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credential in n8n with appropriate permissions to read field metadata.

Troubleshooting

Common issues:

  • Invalid Collection or Field Name: If the provided collection or field does not exist, you'll receive an error message from the Directus API.
  • Insufficient Permissions: If the API credentials lack permission to read field metadata, the request will fail.
  • Network/Connection Errors: Ensure that n8n can reach your Directus instance.

Error messages and resolutions:

  • "error": "Request failed with status code 404"
    Resolution: Check that both the collection and field names are correct and exist in your Directus instance.
  • "error": "Unauthorized"
    Resolution: Verify your API credentials and their permissions in Directus.

Links and References


Discussion