Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

The "Import File Data" operation under the Utility resource is designed to import data from a file into a specified collection. This node is useful when you need to bulk upload or migrate data from external files (such as CSV, JSON, etc.) directly into your application's database or content management system. Common scenarios include onboarding new datasets, synchronizing data between systems, or restoring backups.

Practical Example:
You have a CSV file containing a list of articles. By using this node, you can import all articles into the "articles" collection in one step.

Properties

Name Meaning
Collection Name Unique name of the collection to import the data to. Options are dynamically loaded.
Binary Property Name of the Binary Property where the file is stored.

Output

  • The output will be a JSON object reflecting the result of the import operation.
  • The structure typically includes information about the imported records, such as success status, number of records imported, and any errors encountered.
  • If binary data is involved, it refers to the file being imported; however, the output itself is expected to be in JSON format summarizing the import results.

Dependencies

  • Requires access to the target system or service where the collection resides (e.g., a Directus instance).
  • May require authentication credentials or API keys configured in n8n for the connection.
  • The file to be imported must be available as a binary property in the workflow.

Troubleshooting

  • Common Issues:

    • Incorrect collection name: Ensure the collection exists and is spelled correctly.
    • Missing or incorrect binary property: Verify that the file is attached to the correct binary property.
    • File format issues: The file must be in a supported format (e.g., CSV, JSON) compatible with the import process.
  • Error Messages:

    • "Collection not found": Check the collection name and ensure it exists in the target system.
    • "Binary property missing": Make sure the file is uploaded and referenced by the correct binary property name.
    • "Invalid file format": Confirm the file's format matches what the import expects.

Links and References

Discussion