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 block-level operations. Specifically, the Get Block Attributes operation retrieves all attributes—both built-in (like title, alias) and custom—associated with a particular content block identified by its unique ID.

Use cases include:

  • Extracting metadata or custom tags from specific blocks within documents.
  • Automating workflows that depend on block attributes for conditional processing.
  • Synchronizing or auditing block properties across notebooks or documents.

For example, you might use this operation to fetch the "title" and any custom status tags of a paragraph block to decide if it needs updating or further processing in your workflow.

Properties

Name Meaning
Block ID The unique identifier of the block (paragraph, list, image, or entire document) whose attributes you want to retrieve.

Output

The output is a JSON object containing all attributes of the specified block. This includes both standard attributes (such as title, alias) and any custom attributes defined by the user (typically prefixed with custom-). The structure is a simple key-value map where keys are attribute names and values are their corresponding values.

Example output JSON:

{
  "title": "Introduction",
  "alias": "intro",
  "custom-status": "draft",
  "custom-priority": "high"
}

No binary data is produced by this operation.

Dependencies

  • Requires an active connection to the SiYuan API, authenticated via an API URL and an API token credential.
  • The node depends on the SiYuanClient library bundled with the node implementation to communicate with the SiYuan backend.
  • Proper configuration of the API credentials in n8n is necessary before using this node.

Troubleshooting

  • Missing Credentials Error: If the node throws a "Credentials missing!" error, ensure that the API URL and API token are correctly set up in the node's credentials.
  • Invalid Block ID: Providing a non-existent or malformed block ID will likely result in an error from the SiYuan API. Verify the block ID is correct and exists in your workspace.
  • Unsupported Operation: If the operation parameter is incorrect or misspelled, the node will throw an unsupported operation error.
  • API Connectivity Issues: Network problems or incorrect API endpoint URLs can cause failures. Confirm network access and API URL correctness.
  • Permission Denied: Insufficient permissions associated with the API token may prevent fetching block attributes.

Links and References

Discussion