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 Roles → Update Multiple operation in this n8n node allows you to update multiple roles at once in a Directus instance. This is particularly useful for administrators or automation workflows that need to modify properties (such as permissions, icons, or descriptions) of several roles simultaneously, rather than updating each role individually.
Practical examples:
- Changing the icon or description for a set of roles after a rebranding.
- Bulk-updating access permissions for multiple user groups.
- Automating role updates as part of a larger data migration or synchronization process.
Properties
Name | Type | Meaning |
---|---|---|
Data (JSON) | json | A JSON object containing: - keys : Array of primary keys (IDs) of the roles to update.- data : An object with the fields and values to update for those roles. See Directus Role Object for available properties. |
Output
- The output will be a
json
field containing the result of the bulk update operation. - The structure typically reflects the updated role objects as returned by the Directus API. 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 include an
error
property with the error message.
Dependencies
- Directus API: Requires a valid Directus instance accessible from your n8n environment.
- API Credentials: You must configure the
directusApi
credentials in n8n with appropriate permissions to update roles.
Troubleshooting
Common issues:
- Invalid or missing role IDs: If any ID in the
keys
array does not correspond to an existing role, the API may return an error. - Insufficient permissions: The API credentials used must have permission to update roles; otherwise, you'll receive an authorization error.
- Malformed JSON: The
Data (JSON)
property must be valid JSON. Syntax errors will cause the node to fail. - Partial updates: If some roles are updated successfully but others fail, and "Continue On Fail" is enabled, only the failed updates will be reported as errors.
Error messages and resolutions:
"Cannot read property 'keys' of undefined"
: Ensure your input JSON includes bothkeys
anddata
."Request failed with status code 403"
: Check your API credentials and permissions."Unexpected token ... in JSON"
: Validate your JSON syntax before submitting.