From 61d3182beaff6126c214dabdc7ef94c3d2f2b6a5 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Tue, 31 Jan 2023 13:57:53 -0500 Subject: [PATCH] docs: add thumbnail request documentation Signed-off-by: Eric Callahan --- docs/web_api.md | 76 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 7 deletions(-) diff --git a/docs/web_api.md b/docs/web_api.md index bc98c95..7f5e62e 100644 --- a/docs/web_api.md +++ b/docs/web_api.md @@ -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