Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Overview
This node integrates with the Directus API, allowing users to interact with various Directus resources programmatically. Specifically, for the Roles resource with the Get operation, it retrieves detailed information about a single role by its unique identifier.
Typical use cases include:
- Fetching role details to manage user permissions dynamically.
- Integrating role data into workflows that require role-based access control.
- Automating administrative tasks related to user roles in a Directus-managed system.
For example, you might use this node to get the properties of a specific role before assigning it to a new user or to audit existing roles within your application.
Properties
| Name | Meaning |
|---|---|
| ID | The unique identifier (primary key) of the role to retrieve. This is required and should be provided as a string, e.g., "c86c2761-65d3-43c3-897f-6f74ad6a5bd7". |
Output
The output is a JSON object representing the requested role's data as returned by the Directus API. It typically includes all fields associated with the role, such as its name, description, permissions, and any other metadata defined in the Directus instance.
Example output structure (simplified):
{
"id": "c86c2761-65d3-43c3-897f-6f74ad6a5bd7",
"name": "Editor",
"description": "Can edit content",
"permissions": [...],
"meta": {...}
}
No binary data is produced by this operation.
Dependencies
- Requires an active connection to a Directus instance via an API key credential configured in n8n.
- The node uses the Directus REST API endpoints; thus, network access to the Directus server is necessary.
- Proper permissions on the API key are needed to read role information.
Troubleshooting
- Invalid ID or Role Not Found: If the provided role ID does not exist, the API will return an error. Ensure the ID is correct and the role exists.
- Authentication Errors: If the API key is invalid or lacks permission to read roles, authentication errors will occur. Verify the API credentials and their scopes.
- Network Issues: Connectivity problems to the Directus server will cause request failures. Check network settings and server availability.
- Malformed Input: Providing an empty or malformed ID string will result in errors. Always provide a valid UUID string for the role ID.
If the node throws an error, enabling "Continue On Fail" can help capture error messages in the workflow for debugging.