SiYuan icon

SiYuan

Interacts with the SiYuan API using selected operations

Overview

This node integrates with the SiYuan note-taking and knowledge management system via its API, enabling automation of various document and notebook operations. Specifically, the "Get Document ID by Path" operation allows users to retrieve the unique identifier of a document by specifying its human-readable folder-like path within a given notebook.

This is useful in workflows where you need to programmatically reference or manipulate documents but only know their paths rather than their internal IDs. For example, you might want to update or move a document after locating it by its path, or use the ID to fetch further details or content.

Practical examples:

  • Automatically find a meeting notes document by its path /Projects/ClientA/Meeting Notes to append new content.
  • Use the document ID retrieved by path to rename or move the document within the SiYuan workspace.
  • Integrate with other systems by referencing documents through their paths and converting those to IDs for API calls.

Properties

Name Meaning
Notebook ID The unique ID of the SiYuan notebook containing the document. Required for locating the document.
Document Path The folder-like path (starting with /) where the document is located within the notebook. Example: /My Project/Meeting Notes.

Output

The output JSON contains the result of the API call to get the document ID(s) corresponding to the specified path within the notebook. Typically, this will be an object or array including the unique document ID(s) found at that path.

Example output structure (simplified):

[
  {
    "docId": "unique-document-id-string"
  }
]

If multiple documents match the path, multiple IDs may be returned. If no document is found, the output may be empty or indicate no results.

The node does not output binary data for this operation.

Dependencies

  • Requires an active connection to the SiYuan API via an API URL and an API token credential.
  • The user must configure these credentials in n8n before using the node.
  • The node depends on the SiYuanClient library bundled internally to handle API requests.

Troubleshooting

  • Missing Credentials: If the API URL or token is not set or invalid, the node will throw a "Credentials missing!" error. Ensure the API key credential is properly configured.
  • Invalid Notebook ID or Document Path: Providing a wrong notebook ID or a document path that does not exist will result in no document ID found or an error from the API. Double-check the notebook ID and ensure the path starts with /.
  • Unsupported Operation Error: If the operation parameter is incorrectly set, the node will throw an unsupported operation error.
  • API Connectivity Issues: Network problems or incorrect API endpoint URLs can cause failures. Verify connectivity and correct API URL.
  • Permission Issues: The API token must have sufficient permissions to read notebooks and documents.

Links and References

Discussion