Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

The Permission - List operation in this custom n8n node retrieves a list of permissions from a Directus v1 API. It allows users to fetch all or a limited number of permission records, apply filters, sorting, grouping, and even export the results in various formats (CSV, JSON, XML). This node is useful for automating tasks such as auditing user permissions, generating reports, or integrating permission data with other systems.

Practical examples:

  • Fetching all permissions for review or compliance checks.
  • Exporting permission lists to CSV for external analysis.
  • Filtering permissions based on specific criteria (e.g., by role or collection).
  • Aggregating permission data (e.g., count of permissions per role).

Properties

Name Meaning
Return All Whether to return all results or only up to a given limit. If set to false, you can specify a maximum number of results using "Limit".
Limit Max number of results to return. Only available if "Return All" is false. Accepts values between 1 and 100.
Split Into Items Whether to output each element of an array as its own item. Useful for downstream processing in n8n.
JSON/RAW Parameters Whether the query and/or body parameter should be set via the value-key pair UI or as raw JSON.
Body Parameters Body parameters as JSON or RAW. Used when "JSON/RAW Parameters" is enabled.
Additional Fields Collection of extra options to refine the query. Includes:
— Aggregate Aggregate functions (e.g., Average, Count, Maximum, Minimum, SUM) to perform calculations on a set of values.
— Binary Property for Export Data Name of the binary property to download the exported data to. Default is "data".
— Deep (JSON) Allows setting nested relational dataset query parameters as JSON.
— Export Saves the API response to a file. Options: csv, json, xml.
— File Name for Export Data File name for the exported data (without extension). Default is "export".
— Fields Control which fields are returned in the object.
— Filter (JSON) Select items in the collection by given conditions, specified as JSON.
— Group By Grouping field(s) for aggregation (e.g., author, year(publish_date)).
— Meta What metadata to return in the response.
— Offset How many items to skip when fetching data.
— Search Filter by items that contain the given search query in one of their fields.
— Sort How to sort the returned items. Accepts a CSV of fields; use minus sign (-) for descending order, question mark (?) for random sorting.

Output

  • The node outputs a json field containing the list of permissions retrieved from the Directus API.
  • If "Split Into Items" is enabled, each permission will be output as a separate item.
  • If "Export" is used, the data may be output as a binary file (CSV, JSON, or XML), attached to the specified binary property (default: data). In this case, the output will include a reference to the binary data rather than a direct JSON structure.

Dependencies

  • External Service: Requires access to a Directus v1 API endpoint.
  • Authentication: May require API keys or credentials configured in n8n, depending on your Directus setup.
  • n8n Configuration: Ensure any necessary environment variables or credentials for Directus are set up in your n8n instance.

Troubleshooting

  • Common Issues:

    • Invalid Credentials: If authentication fails, check your API key or credentials configuration.
    • API Endpoint Errors: Ensure the Directus API URL is correct and accessible from your n8n instance.
    • Export Errors: If exporting data, ensure the binary property name does not conflict with existing properties and that the file format is supported.
    • Filter/JSON Syntax Errors: When using JSON fields (e.g., Filter, Deep), ensure the JSON syntax is valid.
  • Error Messages:

    • "Request failed with status code 401/403": Indicates authentication or permission issues. Verify your credentials and user permissions in Directus.
    • "Invalid JSON": Check the syntax of any JSON input fields.
    • "Field not found": Ensure that any fields referenced in "Fields", "Group By", or "Aggregate" exist in your Directus schema.

Links and References

Discussion