Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Directus (DrWade) n8n node for the resource Users and operation Update allows you to update an existing user in your Directus instance. This is achieved by sending a PATCH request to the Directus API with the specified user ID and the fields you wish to update.

Common scenarios:

  • Updating user profile information such as name, email, or role.
  • Modifying custom fields on user records.
  • Automating user management tasks, e.g., updating user status based on workflow logic.

Practical example:
You could use this node in an onboarding workflow to automatically assign a new title or department to a user after they complete a training module.


Properties

Name Type Meaning
ID String Primary key of the user. This uniquely identifies which user record to update.
Data (JSON) JSON A partial user object. Contains the fields and values to update for the user.

Output

  • The output will be a single json object representing the updated user record as returned by the Directus API.
  • The structure of the output matches the Directus user object, including only the fields that were updated or are returned by the API.
  • Example output:
    {
      "id": "72a1ce24-4748-47de-a05f-ce9af3033727",
      "email": "user@example.com",
      "first_name": "Jane",
      "last_name": "Doe",
      "title": "CTO",
      ...
    }
    

Dependencies

  • Directus API: You must have access to a running Directus instance.
  • API Credentials: The node requires 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 User ID: If the provided ID does not match any user, the API will return an error.
  • Malformed Data (JSON): If the Data (JSON) property is not valid JSON or does not conform to the expected user object schema, the update will fail.
  • Insufficient Permissions: The API credentials used must have permission to update users in Directus.
  • Error Handling: If an error occurs and "Continue On Fail" is enabled, the output will contain an error field with the error message.

Common error messages:

  • "User not found": The ID does not correspond to any user.
  • "Invalid payload": The data sent is not valid JSON or contains invalid fields.
  • "Forbidden": The API credentials do not have sufficient permissions.

How to resolve:

  • Double-check the user ID.
  • Validate your JSON using a linter or online tool.
  • Ensure your API credentials have the correct permissions.

Links and References

Discussion