docs: add thumbnail request documentation

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-01-31 13:57:53 -05:00
parent c1e4142a40
commit 61d3182bea
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 69 additions and 7 deletions

View File

@ -1712,18 +1712,14 @@ A list of objects, where each object contains file data:
```
#### Get gcode metadata
Get metadata for a specified gcode file. If the file is located in
a subdirectory, then the file name should include the path relative to
the "gcodes" root. For example, if the file is located at:
```
http://host.local/server/files/gcodes/my_sub_dir/my_print.gcode
```
Then the `{filename}` argument should be `my_sub_dir/my_print.gcode`.
Get metadata for a specified gcode file.
HTTP request:
```http
GET /server/files/metadata?filename={filename}
```
JSON-RPC request:
```json
{
@ -1736,6 +1732,13 @@ JSON-RPC request:
}
```
Parameters:
- `filename`: Path to the gcode file, relative to the `gcodes` root.
For example, if the file is located at
`http://host/server/files/gcodes/tools/drill_head.gcode`,
the `filename` should be specified as `tools/drill_head.gcode`
Returns:
Metadata for the requested file if it exists. If any fields failed
@ -1781,6 +1784,65 @@ modified time, and size.
`null`. They will be updated for each print job if the user has the
`[history]` component configured
#### Get Gcode Thumbnails
Returns thumbnail information for a supplied gcode file. If no thumbnail
information is available
HTTP request:
```http
GET /server/files/thumbnails?filename={filename}
```
JSON-RPC request:
```json
{
"jsonrpc": "2.0",
"method": "server.files.thumbnails",
"params": {
"filename": "{filename}"
},
"id": 3545
}
```
Parameters:
- `filename`: Path to the gcode file, relative to the `gcodes` root.
For example, if the file is located at
`http://host/server/files/gcodes/tools/drill_head.gcode`,
the `filename` should be specified as `tools/drill_head.gcode`
Returns:
An array of objects containing thumbnail information. If no
thumbnail information exists for the specified file then the
returned array wil be empty.
```json
[
{
"width": 32,
"height": 32,
"size": 1551,
"thumbnail_path": "test/.thumbs/CE2_FanCover-120mm-Mesh-32x32.png"
},
{
"width": 300,
"height": 300,
"size": 31819,
"thumbnail_path": "test/.thumbs/CE2_FanCover-120mm-Mesh.png"
}
]
```
!!! Note
This information is the same as reported in the `thumbnails` field
of a [metadata](#get-gcode-metadata) object, with one exception.
The `thumbnail_path` field in the result above contains a
path relative to the `gcodes` root, whereas the `relative_path`
field reported in the metadata is relative to the gcode file's
parent folder.
#### Get directory information
Returns a list of files and subdirectories given a supplied path.
Unlike `/server/files/list`, this command does not walk through