Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus n8n node, when configured with the Roles resource and the Delete Multiple operation, allows you to delete multiple roles from a Directus instance in a single workflow execution. This is particularly useful for bulk management of user roles, such as cleaning up unused roles or automating role removal based on certain criteria.
Practical scenarios:
- Automate cleanup of deprecated or test roles.
- Remove access for groups of users by deleting their associated roles.
- Integrate with other systems to synchronize role deletions.
Properties
Name | Type | Meaning |
---|---|---|
Keys (JSON) | JSON | An array of role primary keys (IDs) to be deleted. Example: ["id1", "id2", ...] |
Output
- The output will be an object in the
json
field containing the response from the Directus API after attempting to delete the specified roles. - The structure of the output depends on the Directus API's response, but typically it may look like:
{ "json": { // API response data, e.g., success status, number of deleted items, etc. } }
- If an error occurs and "Continue On Fail" is enabled, the output will contain an
error
property with the error message.
Dependencies
- External Service: Requires access to a running Directus instance.
- Authentication: Needs valid Directus API credentials configured in n8n under the name
directusApi
. - n8n Configuration: No special environment variables are required beyond standard credential setup.
Troubleshooting
Common Issues:
- Invalid Role IDs: If any provided key does not correspond to an existing role, the API may return an error or only partially complete the deletion.
- Insufficient Permissions: The API credentials must have permission to delete roles; otherwise, a permission error will occur.
- Malformed JSON: The "Keys (JSON)" property must be a valid JSON array of strings. Invalid JSON will cause parsing errors.
Error Messages & Resolutions:
"Unexpected token ... in JSON"
: Ensure the "Keys (JSON)" input is valid JSON (e.g.,["id1", "id2"]
)."Permission denied"
: Check that your API credentials have sufficient rights to delete roles."Role not found"
: One or more of the provided IDs do not exist; verify the list of role IDs.
Links and References
Summary:
This operation enables efficient bulk deletion of roles in Directus via n8n, streamlining administrative tasks and integrations. Properly format your input and ensure correct permissions for smooth operation.