Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Overview

This node interacts with a data service to list all "Relation" records, supporting flexible querying and output formatting. It is useful when you need to retrieve relational data collections with options for filtering, sorting, grouping, aggregation, and exporting results in various formats. For example, it can be used to fetch all user-role relations in a system, apply filters to get only active relations, aggregate counts by role, or export the data as CSV for reporting.

Properties

Name Meaning
Return All Whether to return all matching results or limit the number of returned items.
Limit Maximum number of results to return if not returning all (range 1-100).
Split Into Items Whether to output each element of an array as its own separate item.
JSON/RAW Parameters Whether to provide query/body parameters via UI fields or as raw JSON input.
Body Parameters Raw JSON or RAW body parameters to send with the request (used if JSON/RAW Parameters is true).
Additional Fields Collection of optional additional parameters:
- Aggregate Aggregation functions to perform calculations on fields, such as count, average, sum, min, max, etc.
- Binary Property for Export Data Name of the binary property where exported file data will be stored.
- Deep (JSON) Nested relational dataset query parameters in JSON format.
- Export Format to save API response: CSV, JSON, or XML.
- File Name for Export Data Filename (without extension) for exported data files.
- Fields Comma-separated list of fields to include in the returned objects.
- Filter (JSON) JSON filter conditions to select specific items from the collection.
- Group By Field(s) to group results by for aggregation purposes.
- Meta Metadata fields to include in the response.
- Offset Number of items to skip before starting to collect the result set.
- Search Text search query to filter items containing the given string in any field.
- Sort Comma-separated list of fields to sort by; prefix with - for descending order, ? for random order.

Output

The node outputs JSON data representing the list of relation records retrieved according to the specified parameters. If "Split Into Items" is enabled, each element of an array field is output as a separate item. When export options are selected, the node outputs binary data containing the exported file (CSV, JSON, or XML) under the specified binary property name.

Dependencies

  • Requires connection to the target data service API that manages "Relation" resources.
  • Needs appropriate API authentication credentials configured in n8n to authorize requests.
  • Supports exporting data which may require handling binary data within n8n workflows.

Troubleshooting

  • Common issues:
    • Incorrect or missing API credentials leading to authorization errors.
    • Invalid JSON syntax in raw parameter inputs causing request failures.
    • Requesting too many items without pagination may cause timeouts or memory issues.
    • Using unsupported field names in filters, sorts, or aggregations may result in errors.
  • Error messages:
    • Authentication errors: Verify API key/token and permissions.
    • Validation errors on parameters: Check JSON syntax and allowed values.
    • Export failures: Ensure binary property name is valid and workflow supports binary data.

Links and References

  • Refer to the API documentation of the underlying data service for details on supported query parameters, filters, and export formats.
  • n8n documentation on handling binary data and JSON parameters for advanced usage.

Discussion