Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Directus (DrWade) - Presets: Get operation retrieves a specific preset from a Directus instance using its primary key (ID). This is useful for workflows that need to fetch and utilize saved preset configurations, such as user interface settings or filter definitions, within n8n automations.

Common scenarios:

  • Fetching a preset to apply its configuration elsewhere in your workflow.
  • Auditing or displaying preset details for administrative or reporting purposes.

Example use case:
You want to retrieve the filter settings a user has saved in Directus and use them to process or display data accordingly in your automation.


Properties

Name Type Meaning
ID String Primary key of the preset to retrieve. This uniquely identifies which preset will be fetched from Directus.

Output

  • The node outputs a single item with a json field containing the details of the requested preset.
  • The structure of the output depends on the Directus API response for a preset, but typically includes fields such as:
    • id: The unique identifier of the preset.
    • Other preset-specific properties (e.g., name, user, role, collection, filters, layout, etc.).

Example output:

{
  "id": 39,
  "bookmark": "My Filter",
  "user": "1234-abcd",
  "role": null,
  "collection": "articles",
  "search": "",
  "layout": "tabular",
  "layout_query": {},
  "filters": {},
  "fields": [],
  "sort": null
}

Note: Actual fields may vary depending on your Directus setup.


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 ID: If the provided ID does not exist, you may receive an error or an empty result.
  • Authentication errors: Missing or incorrect API credentials will prevent access.
  • Permissions: The authenticated user must have permission to read presets in Directus.

Error messages and resolutions:

  • "error": "Not Found": The specified preset ID does not exist. Double-check the ID.
  • "error": "Unauthorized": Check your Directus API credentials in n8n.
  • "error": "Forbidden": Ensure your user has the necessary permissions in Directus.

Links and References


Discussion