Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Overview

The node provides functionality to update multiple user records in a system that manages users (likely Directus). It allows batch updating of user properties by specifying an array of user IDs and the data fields to update for those users. This is useful in scenarios where you need to apply the same changes to many users at once, such as updating job titles, roles, or other user attributes.

For example, if you want to set the title "CTO" for several users identified by their unique keys, you can provide those keys along with the new title data, and the node will update all specified users accordingly.

Properties

Name Meaning
Data (JSON) JSON object containing two required fields:
- keys: An array of primary key strings identifying the users to update.
- data: An object with any properties of the user object to be updated (e.g., "title": "CTO").

Example value for Data (JSON):

{
  "keys": ["72a1ce24-4748-47de-a05f-ce9af3033727", "9c3d75a8-7a5f-41a4-be0a-1488fd974511"],
  "data": {
    "title": "CTO"
  }
}

Output

The output will contain a JSON field representing the result of the update operation. Typically, this would include confirmation of which user records were updated and possibly the updated user objects or status messages. The exact structure depends on the underlying API response but generally confirms successful updates.

If the node supports binary data output, it would relate to any files or attachments associated with users, but based on the provided code and context, this node focuses on JSON data updates only.

Dependencies

  • Requires access to the user management API (such as Directus) with appropriate permissions to update user records.
  • Needs an API authentication token or API key configured in n8n credentials to authorize requests.
  • The node relies on bundled methods and router logic from its dependencies to perform the update operation.

Troubleshooting

  • Invalid keys array: If the keys array is empty or contains invalid user IDs, the update will fail or no users will be updated. Ensure valid user IDs are provided.
  • Insufficient permissions: Errors may occur if the API credentials do not have permission to update users. Verify API key scopes and permissions.
  • Malformed JSON data: The data field must be a valid JSON object matching the user schema. Invalid fields or types may cause errors.
  • API connectivity issues: Network problems or incorrect API endpoint configuration can lead to request failures.
  • Common error messages will typically indicate missing required fields (keys or data), unauthorized access, or validation errors on user properties.

Links and References

Discussion