Actions25
- Append Block
- Create Document
- Create Notebook
- Delete Block
- Execute SQL Query
- Export Document Markdown
- Get Block Attributes
- Get Block Kramdown
- Get Child Blocks
- Get Document ID by Path
- Get Document Path by ID
- Insert Block
- List Documents in Notebook
- List Files in Directory
- Move Document
- Prepend Block
- Push Error Message
- Push Message
- Remove Document
- Remove Notebook
- Rename Document
- Rename Notebook
- Render Sprig Template
- Set Block Attributes
- Update Block
Overview
The node interacts with the SiYuan note-taking and knowledge management system via its API. Specifically, the "Set Block Attributes" operation allows users to add or update custom or built-in attributes on a specific content block within SiYuan. Blocks can be paragraphs, lists, images, or entire documents.
This operation is useful when you want to programmatically modify metadata or properties of a block, such as setting titles, aliases, tags, or custom-defined attributes (which must start with custom-). For example, you could tag certain blocks with a status attribute like custom-status: reviewed or update the title attribute of a paragraph block.
Practical scenarios include:
- Automating organization by tagging blocks based on external data.
- Updating block metadata in bulk during migrations or integrations.
- Enhancing searchability by adding custom attributes to blocks.
Properties
| Name | Meaning |
|---|---|
| Block ID | The unique identifier of the block whose attributes you want to set or update. |
| Attributes | One or more name/value pairs defining the attributes to add or update on the block. Custom names must start with custom-. Example attribute names: title, alias, custom-status. |
Output
The output JSON contains the result returned by the SiYuan API after setting the block attributes. Typically, this will confirm success or provide details about the updated block's attributes.
The exact structure depends on the SiYuan API response but generally includes confirmation of the updated attributes.
No binary data output is involved in this operation.
Dependencies
- Requires an active connection to the SiYuan API.
- Needs credentials providing the API URL and an API authentication token.
- The node uses a bundled SiYuan client library to communicate with the API.
Troubleshooting
- Missing Credentials: If the API URL or token is not provided, the node will throw a "Credentials missing!" error. Ensure that valid credentials are configured.
- Invalid Block ID: Providing a non-existent or incorrect block ID may cause errors from the API indicating the block was not found.
- Attribute Naming: Custom attribute names must start with
custom-. Using invalid names might cause the API to reject the request. - API Errors: Network issues or API downtime can cause failures. Check connectivity and API status.
- Continue On Fail: If enabled, the node will continue processing other items even if one fails, returning error messages in the output.
Links and References
- SiYuan Official Website
- SiYuan API Documentation
- Markdown Guide (for understanding block content formatting)