Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Overview

The node provides functionality to update a file object in a Directus system. It allows users to modify metadata of an existing file or replace the file content itself by uploading new binary data. This is useful when you need to update file attributes such as filename, title, or description, or when you want to replace the actual file content without creating a new file entry.

Common scenarios include:

  • Updating metadata fields of a file after it has been uploaded.
  • Replacing an outdated file with a new version while keeping the same file ID.
  • Managing files programmatically within workflows that integrate with Directus.

Properties

Name Meaning
Send Binary Data Whether to upload/create a new file content (true) or just update metadata fields (false).
ID Unique identifier of the file object to update.
Binary Property Name(s) of the binary property(ies) containing the file data to upload when replacing the file content. For multiple files, provide comma-separated names.
Update Fields Additional metadata fields of the file object to update, provided as JSON. These correspond to properties defined in the Directus file object schema.

Output

The node outputs JSON data representing the updated file object as returned by the Directus API. This includes all standard file properties such as ID, filename, URL, size, and any updated metadata fields.

If binary data is sent, the output confirms the successful upload and update of the file content.

No binary output is produced by this node; it only processes binary input for upload purposes.

Dependencies

  • Requires access to a Directus instance with appropriate permissions to update files.
  • Needs an API authentication token or API key credential configured in n8n to authorize requests.
  • The node depends on internal methods and routing logic bundled in the source code but does not require external npm packages beyond those included in the bundle.

Troubleshooting

  • Invalid File ID: If the provided file ID does not exist, the node will fail. Verify the ID is correct and the file exists in Directus.
  • Permission Denied: Insufficient permissions to update files will cause authorization errors. Ensure the API credentials have write access to files.
  • Binary Data Issues: When Send Binary Data is true, ensure the specified binary property exists and contains valid file data. Missing or malformed binary data will cause upload failures.
  • Malformed JSON in Update Fields: Invalid JSON syntax in the "File Object (JSON)" field can cause errors. Validate JSON before execution.
  • Network or API Errors: Connectivity issues or Directus API downtime will result in request failures. Check network and service status.

Links and References

Discussion