SiYuan icon

SiYuan

Interacts with the SiYuan API using selected operations

Overview

This node integrates with the SiYuan API to perform various operations related to managing notebooks, documents, blocks, and files within a SiYuan workspace. Specifically, the "List Files in Directory" operation allows users to retrieve a list of files and folders located at a specified directory path inside the SiYuan workspace.

Common scenarios where this node is beneficial include:

  • Automating file management tasks within SiYuan workspaces.
  • Retrieving directory contents for further processing or conditional workflows.
  • Integrating SiYuan file structures into broader automation pipelines.

For example, you might use this node to list all assets in a particular notebook's data directory (/data/notebook_id/) and then process or move those files based on your workflow logic.

Properties

Name Meaning
Directory Path The path of the directory within the SiYuan workspace to list files from (e.g., /data/notebook_id/, /assets/). Must start with a forward slash /.

Output

The output is a JSON array representing the files and folders found within the specified directory path. Each item in the array typically contains metadata about a file or folder such as its name, type (file or folder), size, modification date, etc., depending on what the SiYuan API returns.

No binary data output is produced by this operation.

Dependencies

  • Requires an active connection to the SiYuan API via credentials that provide:
    • The base URL of the SiYuan API.
    • An API authentication token.
  • The node depends on the SiYuanClient library to communicate with the SiYuan API.
  • Proper configuration of these credentials in n8n is necessary before using the node.

Troubleshooting

  • Missing Credentials: If the API URL or token is not set or invalid, the node will throw a "Credentials missing!" error. Ensure that the API credentials are correctly configured.
  • Invalid Directory Path: The directory path must start with /. Providing an incorrect or non-existent path may result in empty results or errors from the API.
  • API Connectivity Issues: Network problems or incorrect API URLs can cause failures. Verify network access and API endpoint correctness.
  • Unsupported Operation Error: This node supports many operations; ensure "List Files in Directory" is selected when intending to list files.

Links and References

Discussion