An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 提供读写文件 API Fix https://github.com/siyuan-note/siyuan/issues/4343
Liang Dingfcf1ec4c914c
diff --git a/API.md b/API.mdindex 0730d2fccf..4d15bc941a 100644--- a/API.md+++ b/API.md@@ -34,6 +34,9 @@* [Execute SQL query](#Execute-SQL-query)* [Templates](#Templates)* [Render a template](#Render-a-template)+* [File](#File)+ * [Get File](#Get-file)+ * [Put File](#Put-file)* [Export](#Export)* [Export Markdown](#Export-Markdown)* [System](#System)@@ -50,7 +53,8 @@* Endpoint: `http://127.0.0.1:6806`* Both are POST methods-* An interface with parameters is required, the parameter is a JSON string, placed in the body, and the header Content-Type is `application/json`+* An interface with parameters is required, the parameter is a JSON string, placed in the body, and the header+ Content-Type is `application/json`* Return value````json@@ -61,9 +65,9 @@}````- * `code`: non-zero for exceptions- * `msg`: an empty string under normal circumstances, an error text will be returned under abnormal conditions- * `data`: may be `{}`, `[]` or `NULL`, depending on the interface+ * `code`: non-zero for exceptions+ * `msg`: an empty string under normal circumstances, an error text will be returned under abnormal conditions+ * `data`: may be `{}`, `[]` or `NULL`, depending on the interface### Authentication@@ -305,7 +309,8 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T```* `notebook`: Notebook ID- * `path`: Document path, which needs to start with / and separate levels with / (path here corresponds to the database hpath field)+ * `path`: Document path, which needs to start with / and separate levels with / (path here corresponds to the+ database hpath field)* `markdown`: GFM Markdown content* Return value@@ -318,7 +323,8 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T```* `data`: Created document ID- * If you use the same `path` to call this interface repeatedly, the existing document will not be overwritten, but a new document ending with a random number will be created+ * If you use the same `path` to call this interface repeatedly, the existing document will not be overwritten, but a+ new document ending with a random number will be created### Rename a document@@ -432,7 +438,7 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T}```- * `id`:Block ID+ * `id`:Block ID* Return value```json@@ -474,7 +480,9 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T```* `errFiles`: List of filenames with errors in upload processing- * `succMap`: For successfully processed files, the key is the file name when uploading, and the value is assets/foo-id.png, which is used to replace the asset link address in the existing Markdown content with the uploaded address+ * `succMap`: For successfully processed files, the key is the file name when uploading, and the value is+ assets/foo-id.png, which is used to replace the asset link address in the existing Markdown content with the+ uploaded address## Blocks@@ -780,12 +788,11 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T* `/api/file/getFile`* Parameters- ``json- {- "path": "/data/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy"- }- ``- * `path`: the file path under the workspace path+ ``json {+ "path": "/data/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy"+ }+ ``+ * `path`: the file path under the workspace path* Return valueFile content@@ -795,10 +802,10 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T* `/api/file/putFile`* The parameter is an HTTP Multipart form- * `path`: the file path under the workspace path- * `isDir`: whether to create a folder, when `true` only create a folder, ignore `file`- * `modTime`: last access and modification time, Unix time- * `file`: the uploaded file+ * `path`: the file path under the workspace path+ * `isDir`: whether to create a folder, when `true` only create a folder, ignore `file`+ * `modTime`: last access and modification time, Unix time+ * `file`: the uploaded file* return value```json