Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

This node is designed to delete a collection in a Directus instance. It is useful when you need to programmatically remove an entire collection (table) from your Directus-managed database. Common scenarios include cleaning up unused collections, automating schema changes, or managing environments where collections are dynamically created and removed.

Practical Example:
You might use this node in an automation workflow that resets a staging environment by deleting test collections after running integration tests.

Properties

Name Type Meaning
Collection Name options Unique name of the collection to delete. This is required and selectable from existing collections in Directus.

Output

The output will typically be a JSON object indicating the result of the deletion operation. The structure may include fields such as:

{
  "success": true,
  "message": "Collection deleted successfully"
}

If the node can output binary data, it would represent the response from the Directus API, but for this operation, only JSON output is expected.

Dependencies

  • Directus Instance: Requires access to a Directus server.
  • API Key/Authentication: You must configure authentication credentials for the Directus API within n8n.
  • n8n Configuration: Ensure the node is properly configured with the correct Directus endpoint and credentials.

Troubleshooting

  • Common Issues:

    • Invalid Collection Name: If the specified collection does not exist, the node may return an error indicating the collection was not found.
    • Insufficient Permissions: If the API key or user does not have permission to delete collections, you may receive an authorization error.
    • Connection Errors: Network issues or incorrect Directus endpoint configuration can cause connection failures.
  • Error Messages and Resolutions:

    • "Collection not found": Verify the collection name is correct and exists in Directus.
    • "Unauthorized" or "Forbidden": Check your API credentials and ensure the user has sufficient permissions.
    • "Network Error": Confirm the Directus server URL is correct and reachable from n8n.

Links and References

Discussion