Directus icon

Directus

Consume Directus API

Overview

This node integrates with the Directus API, allowing users to perform various operations on Directus resources. Specifically, for the Presets resource with the Create operation, it enables creating a new preset in the Directus system by sending a JSON object representing the preset data.

Typical use cases include automating the creation of presets that define user-specific or system-wide configurations, such as layout preferences or search filters, within a Directus project. For example, you might create a preset to save a user's preferred dashboard layout or search parameters, which can then be reused or shared.

Properties

Name Meaning
Data (JSON) A JSON object representing a partial preset object to create. This should conform to the Directus preset object schema. Example:
json { "user": "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca", "layout": "cards", "search": "Directus" }

Output

The output is a JSON object containing the response from the Directus API after creating the preset. It typically includes the details of the newly created preset, such as its ID and the properties set.

Example output structure:

{
  "id": "preset-uuid",
  "user": "410b5772-e63f-4ae6-9ea2-39c3a31bd6ca",
  "layout": "cards",
  "search": "Directus",
  // ... other preset fields returned by Directus
}

No binary data output is involved in this operation.

Dependencies

  • Requires an active connection to a Directus instance via an API key credential.
  • The node uses the Directus REST API endpoint for presets (POST /presets).
  • Proper permissions are required in Directus to create presets.
  • No additional environment variables are needed beyond the configured Directus API credentials.

Troubleshooting

  • Invalid JSON in Data (JSON) property: Ensure the JSON provided is well-formed and matches the expected schema for a preset object. Malformed JSON will cause request failures.
  • Authentication errors: Verify that the API key credential used has sufficient permissions to create presets in the Directus instance.
  • API errors from Directus: Errors returned by the Directus API (e.g., validation errors, permission denied) will be surfaced in the node's output. Review the error message for details.
  • Network issues: Ensure the Directus server URL is reachable from the n8n environment.

Links and References

Discussion