Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

The Relation - List All operation in this custom n8n node is designed to retrieve a list of relations from a data source, likely an API such as Directus. It provides flexible options for filtering, sorting, grouping, and exporting the results. This node is beneficial when you need to fetch and process relational data, possibly for reporting, analytics, or integration with other systems.

Common scenarios:

  • Fetching all relations for data synchronization.
  • Exporting relation data in CSV, JSON, or XML formats for external analysis.
  • Applying filters, aggregations, or groupings to generate reports (e.g., "Count of relations by type").
  • Integrating relation data into workflows for further automation.

Practical examples:

  • Retrieve all relations and export them as a CSV file for backup.
  • Get only the first 10 relations that match certain criteria.
  • Aggregate relations by a specific field and calculate totals.

Properties

Name Meaning
Return All Whether to return all results or only up to a given limit. If set to false, the Limit property determines how many items are returned.
Limit Max number of results to return. Only used if "Return All" is set to 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/RAW input.
Body Parameters Body parameters as JSON or RAW. Used when "JSON/RAW Parameters" is enabled.
Additional Fields Collection of extra options to customize the request. Includes:
- Aggregate
- Binary Property for Export Data
- Deep (JSON)
- Export
- File Name for Export Data
- Fields
- Filter (JSON)
- Group By
- Meta
- Offset
- Search
- Sort
Aggregate Allows performing calculations on a set of values, returning a single result. Options include:
Average, Average Distinct, Count, Count Distinct, Maximum, Minimum, SUM, SUM Distinct. Field to apply aggregation can be selected.
Binary Property for Export Data Name of the binary property to download the exported data to (default: "data").
Deep (JSON) Set any of the other query parameters on a nested relational dataset using 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 collection by given conditions, specified as JSON.
Group By Grouping allows running aggregation functions based on a shared value (e.g., "Average rating per month").
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.

Output

  • The node outputs a json field containing the list of relations retrieved from the data source.
  • If "Export" is enabled, 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.
  • When "Split Into Items" is enabled, each relation is output as a separate item in the workflow.

Example output structure:

[
  {
    "json": {
      "id": 1,
      "name": "relation_name",
      // ...other fields depending on 'Fields' and 'Additional Fields'
    }
  },
  ...
]

If exporting:

[
  {
    "binary": {
      "data": {
        "fileName": "export.csv",
        "mimeType": "text/csv"
        // ...binary file data
      }
    }
  }
]

Dependencies

  • Requires access to the underlying data source/API (such as Directus).
  • May require API credentials or authentication configured in n8n.
  • No additional npm dependencies are visible from the static code.

Troubleshooting

Common issues:

  • Authentication errors: Ensure API credentials are correctly configured in n8n.
  • Invalid filter/group/aggregate syntax: Double-check JSON formatting and field names.
  • Limit exceeded: If "Limit" is set above the allowed maximum (100), reduce the value.
  • Export errors: If exporting, ensure the binary property name does not conflict with existing properties.

Error messages and resolutions:

  • "Invalid JSON in filter/body/deep parameters": Check your JSON syntax.
  • "Missing required property": Ensure all required fields are filled, especially when "JSON/RAW Parameters" is enabled.
  • "API error: Unauthorized/Forbidden": Verify your API credentials and permissions.

Links and References

Discussion