Directus icon

Directus

Consume Directus API

Overview

The Directus n8n node, when configured with the Preset resource and the Delete Multiple operation, allows you to delete multiple preset records from a Directus instance in a single workflow execution. This is particularly useful for bulk management of presets, such as cleaning up unused configurations or automating administrative tasks.

Practical scenarios:

  • Removing several outdated or unnecessary presets at once.
  • Automating cleanup processes after batch operations.
  • Integrating with other systems to synchronize or reset preset configurations.

Properties

Name Type Meaning
Keys (JSON) JSON An array of preset primary keys. These are the unique identifiers of the presets you want to delete. Example: [15, 251, 810]

Output

The output will be an array of objects, each containing a json field. The structure of the json field depends on the response from the Directus API after attempting to delete the specified presets. Typically, it may include:

  • A summary of the deletion result (such as number of deleted items or status).
  • If an error occurs and "Continue On Fail" is enabled, the json field will contain an error property with the error message.

Example output:

[
  {
    "json": {
      "success": true,
      "deleted": [15, 251, 810]
    }
  }
]

or, in case of error:

[
  {
    "json": {
      "error": "Some error message"
    }
  }
]

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the node with valid Directus API credentials (directusApi).
  • n8n Configuration: No special environment variables are required beyond standard credential setup.

Troubleshooting

Common issues:

  • Invalid Keys Format: Ensure that the "Keys (JSON)" property is a valid JSON array of numeric or string IDs.
  • Permission Denied: The provided API credentials must have permission to delete presets.
  • Non-existent Keys: If any of the provided keys do not exist, the API may return an error or ignore those keys.
  • Malformed JSON: If the input is not valid JSON, the node will throw a parsing error.

Error messages and resolutions:

  • "Unexpected token ... in JSON": Check that your "Keys (JSON)" input is properly formatted.
  • "Permission denied": Verify your Directus user has sufficient rights.
  • "Not found": One or more keys do not correspond to existing presets.

Links and References

Discussion