This commit is contained in:
Liang Ding 2022-03-24 00:25:41 +08:00
parent 561e722f6d
commit fcf1ec4c91
No known key found for this signature in database
GPG Key ID: 136F30F901A2231D

43
API.md
View File

@ -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 value
File 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