From 85be5cbfc13635b80bcbafc7df5a416e7122d47b Mon Sep 17 00:00:00 2001 From: Arksine Date: Tue, 20 Apr 2021 18:03:24 -0400 Subject: [PATCH] docs: add "checksum" option to file upload documentation Signed-off-by: Eric Callahan --- docs/web_api.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/web_api.md b/docs/web_api.md index 27b2683..3644336 100644 --- a/docs/web_api.md +++ b/docs/web_api.md @@ -1347,22 +1347,35 @@ below. HTTP request: ```http POST /server/files/upload` +Content-Type: multipart/form-data + +------FormBoundaryemap3PkuvKX0B3HH +Content-Disposition: form-data; name="file"; filename="myfile.gcode" +Content-Type: application/octet-stream + + +------FormBoundaryemap3PkuvKX0B3HH-- ``` The file must be uploaded in the request's body `multipart/form-data` (ie: -``). The following fields may also be added to the form: +``). The following arguments may also be added to the +form-data: - `root`: The root location in which to upload the file. Currently this may -be `gcodes` or `config`. If not specified the default is `gcodes`. + be `gcodes` or `config`. If not specified the default is `gcodes`. - `path`: This argument may contain a path (relative to the root) indicating -a subdirectory to which the file is written. If a `path` is present the -server will attempt to create any subdirectories that do not exist. + a subdirectory to which the file is written. If a `path` is present the + server will attempt to create any subdirectories that do not exist. +- `checksum`: A SHA256 hex digest calculated by the client for the uploaded + file. If this argument is supplied the server will compare it to its own + checksum calculation after the upload has completed. A checksum mismatch + will result in a 422 error. Arguments available only for the `gcodes` root: - `print`: If set to "true", Klippy will attempt to start the print after -uploading. Note that this value should be a string type, not boolean. This -provides compatibility with Octoprint's legacy upload API. + uploading. Note that this value should be a string type, not boolean. This + provides compatibility with Octoprint's legacy upload API. JSON-RPC request: Not Available