Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Directus (DrWade) n8n node for the resource Presets and operation Delete Multiple allows users to delete multiple preset records in a Directus instance at once. This is particularly useful for bulk management of presets, such as cleaning up unused configurations or performing mass updates where deletion is required.

Practical scenarios:

  • Removing several outdated or unnecessary presets from your Directus project in one workflow step.
  • Automating cleanup tasks after batch operations that render certain presets obsolete.

Properties

Name Type Meaning
Keys (JSON) json An array of preset primary keys to be deleted. Example: [15, 251, 810]. Required.

Output

  • The output will be an object in the json field containing the response from the Directus API after attempting to delete the specified presets.
  • The structure of the output depends on the Directus API's response for bulk deletions. Typically, it may include information about the deleted items or a status message.
  • If an error occurs and "Continue On Fail" is enabled, the output will contain an error property with the error message.

Example output:

{
  "json": {
    // Response data from Directus, e.g.,
    "data": [
      { "id": 15, "status": "deleted" },
      { "id": 251, "status": "deleted" },
      { "id": 810, "status": "deleted" }
    ]
  }
}

Or, in case of error:

{
  "json": {
    "error": "Error message here"
  }
}

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 Keys Format: Ensure that "Keys (JSON)" is a valid JSON array of numeric IDs. Invalid JSON or wrong data types will cause errors.
  • Missing Permissions: The API user must have permission to delete presets in Directus.
  • Non-existent IDs: If any provided key does not correspond to an existing preset, the API may return an error or partial success depending on Directus configuration.
  • Error Handling: If "Continue On Fail" is enabled, errors for individual executions will be returned in the output under the error property.

Common error messages:

  • "Invalid JSON": The input for "Keys (JSON)" is not valid JSON. Double-check your syntax.
  • "Permission denied": The API credentials do not have sufficient rights to delete presets.
  • "Preset not found": One or more IDs do not exist in the system.

Links and References

Discussion