Directus icon

Directus

Consume Directus API

Overview

This node integrates with the Directus API to manage various resources, including Roles. Specifically, for the "Roles" resource and the "Delete" operation, it allows users to delete a role by its primary key (ID). This is useful in scenarios where you need to programmatically remove user roles from your Directus instance, such as cleaning up unused roles or automating role management workflows.

Practical example: If you have an automated process that deactivates certain user groups or roles based on business rules, this node can be used to delete those roles directly via the API without manual intervention.

Properties

Name Meaning
ID The unique identifier (primary key) of the role to delete. This is required to specify which role should be removed.

Output

The output JSON contains the response from the Directus API after attempting to delete the specified role. Typically, this will include confirmation of deletion or details about the deleted role. The exact structure depends on the Directus API's response but generally includes status information and possibly metadata about the deleted entity.

No binary data output is involved in this operation.

Dependencies

  • Requires an active connection to a Directus instance.
  • Needs an API authentication token credential configured in n8n to authorize requests to the Directus API.
  • The node uses internal helper functions to make HTTP requests to the Directus REST endpoints.

Troubleshooting

  • Common issues:

    • Providing an invalid or non-existent role ID will result in an error from the API indicating the role was not found.
    • Insufficient permissions for the API token may cause authorization errors when attempting to delete roles.
    • Network connectivity problems between n8n and the Directus server can cause request failures.
  • Error messages and resolutions:

    • "Role not found": Verify the ID is correct and the role exists.
    • "Unauthorized" or "Forbidden": Check that the API token has sufficient permissions to delete roles.
    • Timeout or network errors: Ensure the Directus server is reachable and the credentials are valid.

Links and References

Discussion