Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

The Item: Get operation in this custom n8n node retrieves a specific item from a collection by its unique ID. It is designed to interact with a data source (such as a database or API) that organizes data into collections and items. This node is useful for scenarios where you need to fetch detailed information about a single record, such as retrieving a user profile, an article, or any entity stored in a collection.

Practical examples:

  • Fetching the details of a blog post by its ID from an "articles" collection.
  • Retrieving a product's information from an inventory system.
  • Downloading a file or exporting data related to a specific item.

Properties

Name Meaning
ID Unique ID of the file object. Required to specify which item to retrieve. Example: 15.
Collection Name Unique name of the parent collection containing the item. Options are dynamically loaded. Example: articles.
Return All Whether to return all results or only up to a given limit. If set to false, the "Limit" property is used.
Limit Max number of results to return (when "Return All" is false). Range: 1–100. Default: 50.
Additional Fields A collection of advanced options to customize the query and output. Includes:
- Aggregate: Perform calculations like count, sum, average, etc., on fields.
- Binary Property for Export Data: Name of the binary property to download data to.
- Deep (JSON): Set nested query parameters for relational datasets.
- Export: Save response as json, csv, or xml.
- File Name for Export Data: Name for exported file (without extension).
- Fields: Specify which fields to return.
- Filter (JSON): Filter items by conditions.
- Group By: Group results by specified fields.
- Meta: Specify metadata to include in the response.
- Offset: Number of items to skip.
- Search: Search query string.
- Sort: Sorting instructions (CSV of fields, use minus sign for descending, question mark for random).

Aggregate Functions (within Additional Fields)

  • Average
  • Average Distinct
  • Count
  • Count Distinct
  • Maximum
  • Minimum
  • SUM
  • SUM Distinct

Export Options

  • CSV
  • JSON
  • XML

Output

  • The node outputs a json field containing the retrieved item's data, structured according to the selected fields and filters.
  • If the "Export" option is used, the data can be saved as a file in the chosen format (csv, json, or xml). In this case, the output may include a binary property (default name: data) containing the exported file.
  • When aggregation or grouping is used, the output will reflect the calculated values or grouped results.
  • If meta information is requested, additional metadata may be included in the output.

Dependencies

  • Requires access to the underlying data source (e.g., Directus API or similar).
  • May require authentication credentials or API keys, depending on the backend configuration.
  • n8n must be configured to allow network access to the data source.

Troubleshooting

  • Missing or Invalid ID: If the "ID" property is empty or incorrect, the node will not find the item and may return an error or empty result. Ensure the ID exists in the specified collection.
  • Collection Not Found: If the "Collection Name" does not match any available collection, the node will fail. Double-check the collection name.
  • Permission Denied: If the API key or credentials lack permission to read the item, an authorization error will occur.
  • Invalid Filter/Deep/Sort Syntax: Malformed JSON or incorrect syntax in filter, deep, or sort properties can cause errors. Validate your input before running.
  • Export Errors: If exporting to a file, ensure the "File Name" and "Binary Property" are correctly set and do not conflict with other nodes.

Links and References

Discussion