Actions109
- Collections Actions
- Activity Actions
- Assets Actions
- Authentication 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
The Directus (DrWade) n8n node for the resource Roles with the operation Update Multiple allows you to update multiple roles in your Directus instance at once. This is particularly useful when you need to make bulk changes to role properties, such as updating permissions, icons, or other attributes for several roles simultaneously.
Common scenarios:
- Updating the icon or description for a set of roles after a branding change.
- Modifying permissions or settings for multiple roles due to policy updates.
- Bulk enabling/disabling roles or changing their status.
Practical example:
Suppose your organization has several custom roles and you want to update the icon property for all of them to reflect a new visual identity. Instead of updating each role individually, you can use this operation to update all relevant roles in one go.
Properties
| Name | Type | Meaning |
|---|---|---|
| Data (JSON) | json | A JSON object containing two required fields: - keys: An array of role IDs (primary keys) you wish to update. - data: An object with the properties and values to update for those roles. Example: { |
Output
- The output will be a single field named
json, which contains the response from the Directus API after attempting to update the specified roles. - The structure of the output typically mirrors the updated role objects as returned by Directus. For example:
{
"json": [
{
"id": "c86c2761-65d3-43c3-897f-6f74ad6a5bd7",
"icon": "attractions",
// ...other role properties
},
{
"id": "6fc3d5d3-a37b-4da8-a2f4-ed62ad5abe03",
"icon": "attractions",
// ...other role properties
}
]
}
- If an error occurs and "Continue On Fail" is enabled, the output may contain an
errorfield with the error message.
Dependencies
- Directus API: You must have access to a running Directus instance.
- API Credentials: The node requires valid Directus API credentials (
directusApi) configured in n8n. - n8n Configuration: No special environment variables are needed beyond standard credential setup.
Troubleshooting
Common issues:
- Invalid Role IDs: If any of the provided role IDs in
keysdo not exist, the API may return an error or skip those entries. - Malformed JSON: If the
Data (JSON)input is not valid JSON, the node will throw a parsing error. - Insufficient Permissions: The API credentials used must have permission to update roles; otherwise, you'll receive an authorization error.
- Partial Updates: If some roles succeed and others fail, only successful updates will be reflected unless "Continue On Fail" is enabled.
Common error messages:
"Cannot read property 'data' of undefined": Likely due to an unexpected API response or incorrect input format."Request failed with status code 403": Indicates insufficient permissions."Unexpected token ... in JSON": Input is not valid JSON; check your syntax.
How to resolve:
- Double-check that all role IDs in
keysare correct and exist in your Directus instance. - Ensure your JSON input is properly formatted.
- Verify that your API credentials have the necessary permissions.