BaiduWp icon

BaiduWp

调用百度网盘接口

Overview

This node integrates with Baidu Netdisk (Baidu Wangpan) API to manage files and user information on the Baidu cloud storage platform. Specifically, for the "管理文件" (Manage Files) resource and the "复制文件" (Copy File) operation, it allows users to copy files or folders within their Baidu Netdisk storage.

Typical use cases include:

  • Automating file management tasks such as copying multiple files or folders from one directory to another.
  • Batch processing of file operations using JSON or structured collections of file metadata.
  • Integrating Baidu Netdisk file operations into larger workflows, e.g., backing up files or reorganizing directories automatically.

Example: A user wants to copy a set of files from one folder to another in Baidu Netdisk by providing a collection of file paths and destination directories, optionally renaming some files during the copy process.

Properties

Name Meaning
操作合集 A collection of files to operate on. It supports two input modes:
- JSON 合集: A JSON array describing files with properties like path, destination, and new name.
- 文件合集: A fixed collection where each entry includes:
- 文件路径 (path): The source file path to copy.
- 移动目录 (dest): The target directory where the file should be copied.
- 重命名 (newname): Optional new name for the copied file.

The property is required and must contain valid data either as JSON or as a structured collection.

Output

The output is an array of JSON objects representing the result of the copy operation(s). Each object typically contains:

  • path: The path of the copied file or folder in Baidu Netdisk.
  • fs_id: The unique file system ID assigned by Baidu Netdisk.
  • category: The type of item, e.g., "文件夹" (folder).

If multiple files are copied, the output will be a list of these objects corresponding to each file/folder processed.

No binary data output is produced by this operation.

Dependencies

  • Requires an API key credential for Baidu Netdisk API access.
  • Uses Baidu Netdisk REST API endpoints for file management.
  • Requires n8n environment configured with the appropriate Baidu Netdisk API credentials.
  • Relies on internal helper functions for API requests, error handling, and JSON validation.

Troubleshooting

  • Invalid or missing filelist: If the "操作合集" property is empty or invalid, the node throws an error prompting to select a valid operation collection.
  • Invalid JSON format: When using the JSON collection input, if the JSON is malformed or not valid, an error is thrown indicating the JSON is invalid.
  • API errors: The node checks for error codes returned by Baidu API and surfaces them. Common issues might include authentication failures, permission errors, or rate limits.
  • File duplication conflicts: The operation uses "ondup":"fail" parameter, so if a file already exists at the destination with the same name, the copy will fail for that file.
  • Rate limiting: The node includes a delay between batch requests to avoid hitting API rate limits; however, large batches may still encounter throttling.

To resolve errors:

  • Ensure the API credentials are valid and have sufficient permissions.
  • Validate JSON inputs carefully before running.
  • Check file paths and destination directories exist and are accessible.
  • Handle duplicate file names by renaming or removing existing files.

Links and References

Discussion