Mira File Upload
AI-generatedOverview
The "Mira File Upload" node enables uploading or updating files in a specified library on the Mira App Server. It supports both creating new files and updating existing ones by specifying a file ID. The node can take the access token either from stored credentials or directly from input data, allowing flexible authentication methods.
This node is useful in scenarios where you need to automate file management workflows with Mira App Server, such as:
- Automatically uploading generated reports or documents to a Mira library.
- Updating existing files in a library based on changes detected elsewhere.
- Tagging and organizing files within specific folders programmatically.
For example, you could use this node to upload images processed in previous workflow steps into a Mira library, tagging them for easy retrieval later.
Properties
| Name | Meaning |
|---|---|
| Token Source | Choose where to get the access token from: - From Credentials (use token from Mira API credentials) - From Input Data (use token from input data or enter custom token directly) |
| Server URL | The URL of the Mira App Server (required if token source is "From Input Data"). Example: http://localhost:8081 |
| Access Token | Access token string used for authentication when token source is "From Input Data". Can be set via expressions like {{ $json.accessToken }}. |
| Library ID | Target library ID where the file will be uploaded or updated (required). |
| File ID | Optional file ID to update an existing file instead of creating a new one. If provided, the node performs an update operation. |
| Input Binary Field | Name of the binary property containing the file to upload. Required if File ID is not provided (i.e., for new uploads). Default is "file". |
| Source Path | Optional local file path for validation purposes. |
| Client ID | Optional client identifier to associate with the upload. |
| Tags | Optional comma-separated list of tags to assign to the file, e.g., "tag1, tag2, tag3". |
| Folder ID | Optional target folder ID within the library to place the uploaded file. |
Output
The node outputs an array of items corresponding to each input item processed. Each output item contains:
json: An object with details about the upload/update operation:
operation: Either"file_upload"or"file_update"depending on whether a new file was created or an existing one updated.libraryId: The target library ID.fileId: The ID of the updated file (if applicable).fileName: The name of the uploaded file.fileSize: Size of the uploaded file in bytes.mimeType: MIME type of the uploaded file.timestamp: ISO timestamp of when the operation occurred.binaryPropertyUsed: The name of the binary property used for upload (if any).
binary: The original binary data passed through from the input item, preserving the file content.
If an error occurs and "Continue On Fail" is enabled, the output item will contain an error field describing the issue.
Dependencies
- Requires access to a Mira App Server instance reachable via the configured Server URL.
- Authentication requires either:
- An API key credential stored in n8n credentials (used when "Token Source" is "From Credentials").
- Or a valid access token provided in the input data or directly in the node parameters.
- Uses HTTP POST requests with multipart/form-data encoding to upload files.
- Relies on n8n's built-in HTTP request helpers and binary data handling.
Troubleshooting
- Missing Binary Data: If neither a File ID nor a valid binary property is provided, the node throws an error indicating that one of these must be supplied.
- Invalid Binary Property Name: If the specified binary property does not exist in the input item, the node attempts to find common binary properties (
file,files) before failing with an error listing available properties. - Authentication Errors:
- When using token-based authentication, ensure the Server URL and Access Token are correctly set.
- When using credentials, verify the stored API key is valid and has necessary permissions.
- Server URL Missing: If token source is "From Input Data" but Server URL is empty, the node will throw an error.
- File Update vs Upload: Providing a File ID triggers an update operation; omitting it triggers a new upload. Ensure the File ID exists on the server to avoid errors.
- HTTP Request Failures: Network issues or incorrect URLs may cause request failures. Check connectivity and server availability.
Links and References
- Mira App Server API Documentation (hypothetical link for reference)
- n8n HTTP Request Node Documentation
- Working with Binary Data in n8n