Overview
This node integrates with the ERPNext China API, providing access to various ERPNext resources and operations. Specifically, for the "文件处理" (File Handling) resource and the "获取单一文件" (Get Single File) operation, it allows users to retrieve a single file by selecting its name or ID from a list or specifying it via an expression. This is useful in scenarios where workflows need to fetch specific files stored in ERPNext for further processing, such as downloading attachments, processing documents, or integrating file data into other systems.
Practical examples include:
- Automatically retrieving invoice PDFs from ERPNext after they are generated.
- Fetching user-uploaded documents for validation or archival.
- Integrating ERPNext file storage with external cloud services or databases.
Properties
| Name | Meaning |
|---|---|
| File Name or ID | Select a file from a dynamically loaded list of available files or specify a file ID using an expression. |
The property supports choosing from existing files fetched dynamically via the getFiles method, which lists files by their names and IDs.
Output
The node outputs JSON data representing the retrieved file's details. The exact structure depends on the ERPNext API response but typically includes metadata such as file name, size, type, and possibly the file content or a link to download it.
If the node supports binary data output (not explicitly shown in the code), it would represent the actual file content, enabling downstream nodes to process or save the file.
Dependencies
- Requires an API key credential for authenticating with the ERPNext China API.
- Depends on the ERPNext instance being accessible and properly configured to allow API access.
- Uses internal services (
FileService) to fetch file lists and file data. - The node dynamically loads file options via the
getFilesmethod, which queries the ERPNext API.
Troubleshooting
Common issues:
- Failure to authenticate due to invalid or missing API credentials.
- Specifying a file name or ID that does not exist or is inaccessible.
- Network connectivity problems preventing access to the ERPNext API.
Error messages:
"Resource 文件处理 not found or not implemented": Indicates the resource name is incorrect or the implementation is missing.- Errors related to file retrieval usually stem from invalid parameters or API errors; verify the file exists and credentials are valid.
Resolutions:
- Ensure the API key credential is correctly set up and has necessary permissions.
- Use the dynamic dropdown to select valid files or double-check expressions used for file IDs.
- Confirm network connectivity and ERPNext API endpoint availability.
Links and References
- ERPNext Official Documentation
- n8n Expressions Documentation
- ERPNext API Reference (general reference, may differ for China version)