Directus icon

Directus

Consume Directus API

Overview

This node integrates with the Directus API to perform various operations on different resources. Specifically, for the Roles resource and the Update Multiple operation, it allows users to update multiple role records in bulk by specifying their primary keys and the data fields to update.

This is useful in scenarios where you need to modify several roles at once without making individual API calls for each role. For example, you might want to update the icon or permissions of multiple roles simultaneously.

Properties

Name Meaning
Data (JSON) A JSON object containing two required properties:
- keys: An array of primary key strings identifying the roles to update.
- data: An object with any of the role properties to be updated (e.g., "icon": "attractions").

Example value for Data (JSON):

{
  "keys": [
    "c86c2761-65d3-43c3-897f-6f74ad6a5bd7",
    "6fc3d5d3-a37b-4da8-a2f4-ed62ad5abe03"
  ],
  "data": {
    "icon": "attractions"
  }
}

Output

The node outputs an array of JSON objects representing the response from the Directus API after updating the specified roles. The structure corresponds to the updated role objects returned by the API.

  • The output field json contains the updated role data.
  • No binary data output is produced by this operation.

Dependencies

  • Requires a valid connection to a Directus instance via an API key credential configured in n8n.
  • The node uses the Directus REST API endpoints and expects proper authentication.
  • No additional external dependencies are needed beyond the Directus API access.

Troubleshooting

  • Invalid JSON in Data (JSON): If the JSON provided in the "Data (JSON)" property is malformed, the node will throw a parsing error. Ensure the JSON syntax is correct.
  • Missing Keys or Data: The keys array and data object are required. Omitting either will cause the API request to fail.
  • API Authentication Errors: If the API key or credentials are invalid or expired, the node will return authentication errors. Verify the API credentials configuration.
  • Permission Issues: The authenticated user must have permission to update roles. Lack of permissions will result in authorization errors.
  • Network or API Endpoint Errors: Network issues or incorrect Directus API URLs can cause failures. Confirm connectivity and endpoint correctness.

Links and References


This summary focuses on the Roles resource and the Update Multiple operation as requested, based on static analysis of the provided source code and input property definitions.

Discussion