Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Directus (DrWade) - Roles: Update operation allows you to update an existing role in your Directus instance. This is useful for managing user permissions and access levels within your application or content management system. For example, you might use this node to change the name, icon, or permissions of a specific role as part of an automated workflow.

Practical scenarios:

  • Automatically updating role details when organizational policies change.
  • Adjusting role icons or descriptions based on external triggers.
  • Integrating with HR systems to synchronize user roles.

Properties

Name Type Meaning
Data (JSON) json A partial role object. Contains the fields to update for the role, such as icon, name, etc.
ID string Primary key of the role. This uniquely identifies which role will be updated.

Output

  • The output is a single json object representing the updated role.
  • The structure of the output matches the Directus Role Object, including all fields that were updated and other role properties.

Example output:

{
  "id": "c86c2761-65d3-43c3-897f-6f74ad6a5bd7",
  "name": "Editor",
  "icon": "attractions",
  "description": "Can edit content",
  ...
}

Note: The actual fields depend on what was updated and the current state of the role.


Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n for authentication.

Troubleshooting

Common issues:

  • Invalid Role ID: If the provided ID does not match any existing role, the node will return an error.
  • Malformed JSON: If the "Data (JSON)" property contains invalid JSON, the update will fail.
  • Insufficient Permissions: The API credentials used must have permission to update roles; otherwise, you'll receive an authorization error.

Error messages and resolutions:

  • "Role not found": Check that the ID is correct and exists in your Directus instance.
  • "Invalid JSON": Ensure the "Data (JSON)" field is properly formatted.
  • "Unauthorized": Verify that your API credentials are correct and have sufficient privileges.

Links and References

Discussion