Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

The "Permission - Create Multiple" operation in this custom n8n node allows users to create multiple permission objects in a single workflow execution. This is particularly useful when you need to batch-create permissions for different roles, collections, or actions within a system such as Directus. For example, you might use this node to quickly set up read and write access for various user roles across several data collections.

Practical scenarios:

  • Onboarding a new role and assigning it multiple permissions at once.
  • Migrating or synchronizing permissions between environments.
  • Automating the setup of complex access control structures.

Properties

Name Meaning
Data (JSON) An array of partial permissions objects. Each object must include action and collection. Example fields: collection, action, role, fields.

Output

The output will be a JSON array containing the created permission objects, each reflecting the structure defined by the Directus API. Each object typically includes fields such as:

  • id
  • collection
  • action
  • role
  • fields
  • Any other properties supported by the Directus permission object.

No binary data is produced by this operation.

Dependencies

  • External Service: Requires access to a Directus instance with appropriate credentials and permissions to create permissions.
  • API Key / Auth: The node must be configured with valid authentication details for the Directus API.
  • n8n Configuration: Ensure that any required environment variables for connecting to Directus are set.

Troubleshooting

Common Issues:

  • Invalid JSON Input: If the "Data (JSON)" property is not a valid JSON array, the node may throw a parsing error. Ensure your input matches the expected format.
  • Missing Required Fields: Each permission object must include both action and collection. Omitting these will result in an error from the Directus API.
  • Insufficient Permissions: The credentials used must have rights to create permissions; otherwise, you may receive authorization errors.

Error Messages:

  • "Invalid JSON": Check your input for syntax errors.
  • "Missing required field: action/collection": Ensure every object in the array has these fields.
  • "Unauthorized": Verify your API credentials and permissions.

Links and References

Discussion