Actions71
- Asset Actions
- Attribute Actions
- Block Actions
- Database Actions
- Document Actions
- Markdown Table Actions
- Notebook Actions
- Search Actions
- System Actions
- Tag Actions
Document → Get Document Tree
AI-generatedOverview
This node operation retrieves the hierarchical tree structure of a specified document in the SiYuan workspace. It is useful for scenarios where you need to visualize or process the nested structure of a document, such as generating a sitemap, analyzing document organization, or exporting document outlines. For example, you can use it to get the full tree of a project document to understand its sections and subsections.
Use Case Examples
- Retrieve the document tree of a project document to display its structure in a UI.
- Fetch the document tree to export it as a navigable outline in another application.
Properties
| Name | Meaning |
|---|---|
| Document ID | The unique ID of the document to retrieve the tree for. |
| Max Depth | Maximum depth of the sub-document tree to retrieve, limiting how deep the tree structure is fetched. |
Output
JSON
id- The unique identifier of each node in the document tree.title- The title or name of the document or sub-document node.children- An array representing the nested sub-documents or child nodes within the document tree.
Dependencies
- SiYuan API URL and Token for authentication
Troubleshooting
- Ensure the Document ID is correct and exists in the SiYuan workspace to avoid errors.
- Verify that the API URL and Token credentials are properly set and valid.
- If the tree depth is too large, the operation might take longer or time out; adjust the Max Depth accordingly.