From 561e722f6df840183285b84b926e7b53398f2503 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 24 Mar 2022 00:16:17 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=8F=90=E4=BE=9B=E8=AF=BB=E5=86=99?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20API=20https://github.com/siyuan-note/siyua?= =?UTF-8?q?n/issues/4343?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API.md | 38 +++++++++++++++++++++++++++++++++++++- API_zh_CN.md | 4 ++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/API.md b/API.md index aec298e00..0730d2fcc 100644 --- a/API.md +++ b/API.md @@ -771,7 +771,43 @@ View API token in Settings - About, request header: `Authorization: T ### Render a template -/template/render +/api/template/render + +## File + +### Get file + +* `/api/file/getFile` +* Parameters + + ``json + { + "path": "/data/20210808180117-6v0mkxr/20200923234011-ieuun1p.sy" + } + `` + * `path`: the file path under the workspace path +* Return value + + File content + +### Put file + +* `/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 +* return value + + ```json + { + "code": 0, + "msg": "", + "data": null + } + ``` ## Export diff --git a/API_zh_CN.md b/API_zh_CN.md index 4f6a8d3f2..89f36e1f3 100644 --- a/API_zh_CN.md +++ b/API_zh_CN.md @@ -774,7 +774,7 @@ ### 渲染模板 -/template/render +/api/template/render ## 文件 @@ -800,7 +800,7 @@ * `path`:工作空间路径下的文件路径 * `isDir`:是否为创建文件夹,为 `true` 时仅创建文件夹,忽略 `file` - * `modTime`:最近访问时间,Unix time + * `modTime`:最近访问和修改时间,Unix time * `file`:上传的文件 * 返回值