Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Directus (DrWade) n8n node for the resource Presets and operation Update allows you to update an existing preset in your Directus instance. Presets in Directus are used to store user interface preferences, such as layout or filters, for collections or dashboards.

Common scenarios:

  • Updating the layout or filter settings for a specific view in Directus.
  • Modifying saved UI configurations for users or roles.
  • Automating the management of presets across different environments.

Practical example:
Suppose you want to change the default layout of a collection's view from "cards" to "tabular" for a specific preset. You can use this node to update only the relevant fields without overwriting the entire preset object.


Properties

Name Type Meaning
Data (JSON) json A partial preset object. Only the fields provided will be updated. Example: { "layout": "tabular" }
ID string Primary key of the preset to update.

Output

  • The output is a single json object representing the updated preset as returned by the Directus API.
  • The structure matches the Directus preset object, including only the fields present in the response after the update.

Example output:

{
  "id": 39,
  "collection": "articles",
  "layout": "tabular",
  "user": "1",
  "role": null,
  "filters": null,
  ...
}

Note: The actual fields depend on what was updated and the current state of the preset.


Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n with appropriate permissions to update presets.

Troubleshooting

Common issues:

  • Invalid ID: If the provided ID does not correspond to an existing preset, the node will return an error.
  • Malformed JSON: If the "Data (JSON)" property contains invalid JSON, the update will fail.
  • Insufficient Permissions: The API credentials used must have permission to update presets; otherwise, you'll receive an authorization error.

Error messages and resolutions:

  • "Cannot find preset with id X": Check that the ID is correct and exists in your Directus instance.
  • "Invalid JSON in 'Data (JSON)'": Ensure your input is valid JSON.
  • "Unauthorized" or "Forbidden": Verify your API credentials and their permissions.

Links and References

Discussion