From 6ba45f6e357116fceb98cdfc8f181cebd181a11f Mon Sep 17 00:00:00 2001 From: Grigi Date: Sun, 28 Feb 2021 15:43:07 +0200 Subject: [PATCH] docs: Document simulated Octoprint API Signed-off-by: Nickolas Grigoriadis --- docs/configuration.md | 11 +++ docs/web_api.md | 189 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index b5c2579..38053a1 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -95,6 +95,17 @@ cors_domains: The sections outlined here are optional and enable additional functionality in moonraker. +## Octoprint compatibility +Enables partial support of Octoprint API is implemented with the purpose of +allowing uploading of sliced prints to a mainsail instance. +Currently we support Slic3r derivatives and Cura with Cura-Octoprint. + +``` +# moonraker.conf + +[octoprint_compat] +``` + ## paneldue Enables PanelDue display support. The PanelDue should be connected to the host machine, either via the machine's UART GPIOs or through a USB-TTL diff --git a/docs/web_api.md b/docs/web_api.md index 75e373a..1db2120 100644 --- a/docs/web_api.md +++ b/docs/web_api.md @@ -1418,6 +1418,195 @@ The APIs below are available when the `[power]` plugin has been configured. } ``` +## Octoprint API emulation +Partial support of Octoprint API is implemented with the purpose of +allowing uploading of sliced prints to a mainsail instance. +Currently we support Slic3r derivatives and Cura with Cura-Octoprint. + +### Version information +- HTTP command:\ + `GET /api/version` + +- Returns:\ + An object containing simulated Octoprint version information + ```json + { + server: "1.5.0", + api: "0.1", + text: "Octoprint (Moonraker v0.3.1-12)" + } + ``` + +### Server status +- HTTP command:\ + `GET /api/server` + +- Returns:\ + An object containing simulated Octoprint server status + ```json + { + server: "1.5.0", + safemode: + } + ``` + +### Login verification & User information +- HTTP command:\ + `GET /api/login` + +- HTTP command:\ + `GET /api/server` + +- Returns:\ + An object containing stubbed Octoprint login/user verification + ```json + { + _is_external_client: false, + _login_mechanism: "apikey", + name: "_api", + active: true, + user: true, + admin: true, + apikey: null, + permissions: [], + groups: ["admins", "users"], + } + ``` + +### Get settings +- HTTP command:\ + `GET /api/server` + +- Returns:\ + An object containing stubbed Octoprint settings. + The webcam route is hardcoded to Fluidd/Mainsail default path. + We say we have the UFP plugin installed so that Cura-Octoprint will + upload in the preferred UFP format. + ```json + { + plugins: { + UltimakerFormatPackage: { + align_inline_thumbnail: false, + inline_thumbnail: false, + inline_thumbnail_align_value: "left", + inline_thumbnail_scale_value: "50", + installed: true, + installed_version: "0.2.2", + scale_inline_thumbnail: false, + state_panel_thumbnail: true + } + }, + feature: { + sdSupport: false, + temperatureGraph: false + }, + webcam: { + flipH: false, + flipV: false, + rotate90: false, + streamUrl: "/webcam/?action=stream", + webcamEnabled': true + } + } + ``` + +### File Upload +- HTTP command:\ + `POST /api/files/local` + Otherwise identical to the standard Moonraker `POST /server/files/upload` API. + +### Get Job status +- HTTP command:\ + `GET /api/job` + +- Returns:\ + An object containing stubbed Octoprint Job status + ```json + { + job: { + file: {name: null}, + estimatedPrintTime: null, + filament: {length: null}, + user: None + }, + progress: { + completion: null, + filepos: null, + printTime: null, + printTimeLeft: null, + printTimeOrigin: null + }, + state: + } + ``` + +### Get Printer status +- HTTP command:\ + `GET /api/printer` + +- Returns:\ + An object containing Octoprint Printer status + ```json + { + temperature: { + ">: { + actual: , + offset: 0, + target: + } + }, + state: { + text': state, + flags': { + operational: , + paused: , + printing: , + cancelling: , + pausing: False, + error: , + ready: , + closedOrError: + } + } + } + ``` + +### Send GCode command +- HTTP command:\ + `POST /api/printer/command` + + JSON payload with parameter: + * commands: List of GCode strings + +- Returns:\ + An blank JSON object + ```json + {} + ``` + +### List Printer profiles +- HTTP command:\ + `GET /api/printerprofiles` + +- Returns:\ + An object containing simulates Octoprint Printer profile + ```json + { + profiles: { + _default: { + id: "_default", + name: "Default", + color: "default", + model: "Default", + default': true, + current': true, + heatedBed: , + heatedChamber: + } + } + } + ``` + ## Websocket notifications Printer generated events are sent over the websocket as JSON-RPC 2.0 notifications. These notifications are sent to all connected clients