Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Webhooks → Delete Multiple operation in this n8n node allows you to delete multiple webhook records from a Directus instance in a single API call. This is useful for bulk management of webhooks, such as cleaning up unused or obsolete webhooks, or automating the removal of several webhooks at once.

Practical scenarios:

  • Removing all test webhooks after development.
  • Cleaning up webhooks that are no longer needed due to changes in integration requirements.
  • Automating periodic cleanup tasks in your workflow.

Properties

Name Type Meaning
Keys (JSON) JSON An array of webhook primary keys. These identify which webhooks will be deleted. Example: [2, 15, 41]

Output

  • The output is a json object containing the response from the Directus API after attempting to delete the specified webhooks.
  • The structure of the output depends on the Directus API's response, but typically it may include:
    • A summary of the deletion result (e.g., number of records deleted, status).
    • If an error occurs and "Continue On Fail" is enabled, the output will contain an error field with the error message.

Example output:

{
  "json": {
    // Response data from Directus, e.g.,
    "data": { /* details about deleted webhooks */ }
  }
}

or, on error (if "Continue On Fail" is enabled):

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

Dependencies

  • Directus API: You must have access to a Directus instance.
  • API Credentials: The node requires valid Directus API credentials (directusApi) configured in n8n.

Troubleshooting

  • Invalid Keys Format: Ensure that "Keys (JSON)" is a valid JSON array of primary key values. Invalid JSON or wrong data types will cause errors.
  • Non-existent Webhook IDs: If any provided keys do not correspond to existing webhooks, the API may return an error or ignore those keys.
  • Insufficient Permissions: The API credentials used must have permission to delete webhooks in Directus.
  • Common Error Messages:
    • "Unexpected token ...": Indicates invalid JSON in the "Keys (JSON)" property.
    • "Request failed with status code 403": Indicates insufficient permissions.
    • "Not found": One or more webhook IDs do not exist.

How to resolve:

  • Double-check the format and content of the "Keys (JSON)" input.
  • Verify that your API credentials have the necessary permissions.
  • Confirm that the webhook IDs exist in your Directus instance.

Links and References

Discussion