增加根据 ID 获取人类可读路径 API https://github.com/siyuan-note/siyuan/issues/4229

This commit is contained in:
Liang Ding 2022-03-13 10:54:39 +08:00
parent 3f95cc192c
commit a75a097b6e
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 47 additions and 2 deletions

25
API.md
View file

@ -18,6 +18,7 @@
* [Remove a document](#Remove-a-document) * [Remove a document](#Remove-a-document)
* [Move a document](#Move-a-document) * [Move a document](#Move-a-document)
* [Get human-readable path based on path](#Get-human-readable-path-based-on-path) * [Get human-readable path based on path](#Get-human-readable-path-based-on-path)
* [Get human-readable path based on ID](#Get-human-readable-path-based-on-ID)
* [Assets](#Assets) * [Assets](#Assets)
* [Upload assets](#Upload-assets) * [Upload assets](#Upload-assets)
* [Blocks](#Blocks) * [Blocks](#Blocks)
@ -396,7 +397,7 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T
} }
``` ```
### Get human-readable path based on path ### Get human readable path based on path
* `/api/filetree/getHPathByPath` * `/api/filetree/getHPathByPath`
* Parameters * Parameters
@ -420,6 +421,28 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T
} }
``` ```
### Get human readable path based on ID
* `/api/filetree/getHPathByID`
* Parameters
```json
{
"id": "20210917220056-yxtyl7i"
}
```
* `id`Block ID
* Return value
```json
{
"code": 0,
"msg": "",
"data": "/foo/bar"
}
```
## Assets ## Assets
### Upload assets ### Upload assets

View file

@ -30,7 +30,7 @@
* [设置块属性](#设置块属性) * [设置块属性](#设置块属性)
* [获取块属性](#获取块属性) * [获取块属性](#获取块属性)
* [SQL](#SQL) * [SQL](#SQL)
* [SQL 查询](#SQL-查询) * [执行 SQL 查询](#执行-SQL-查询)
* [模板](#模板) * [模板](#模板)
* [渲染模板](#渲染模板) * [渲染模板](#渲染模板)
* [导出](#导出) * [导出](#导出)
@ -420,6 +420,28 @@
} }
``` ```
### 根据 ID 获取人类可读路径
* `/api/filetree/getHPathByID`
* 参数
```json
{
"id": "20210917220056-yxtyl7i"
}
```
* `id`:块 ID
* 返回值
```json
{
"code": 0,
"msg": "",
"data": "/foo/bar"
}
```
## 资源文件 ## 资源文件
### 上传资源文件 ### 上传资源文件