From b620ebbc29a962df24479b275b65a43ca0e3bbd6 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Sat, 20 Jan 2024 12:14:12 -0500 Subject: [PATCH] docs: document status endpoint and notification Signed-off-by: Eric Callahan --- docs/web_api.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/docs/web_api.md b/docs/web_api.md index ce2ed79..d8116b9 100644 --- a/docs/web_api.md +++ b/docs/web_api.md @@ -5335,6 +5335,45 @@ An object containing all measurements for every configured sensor: ### Spoolman APIs The following APIs are available to interact with the Spoolman integration: +### Get Spoolman Status +Returns the current status of the spoolman module. + +HTTP request: +```http +GET /server/spoolman/status +``` +JSON-RPC request: +```json +{ + "jsonrpc": "2.0", + "method": "server.spoolman.status", + "id": 4654 +} +``` + +Returns: + +An object containing details about the current status: + +```json +{ + "spoolman_connected": false, + "pending_reports": [ + { + "spool_id": 1, + "filament_used": 10 + } + ], + "spool_id": 2 +} +``` + +- `spoolman_connected`: A boolean indicating if Moonraker is connected to + Spoolman. When `false` Spoolman is unavailable. +- `pending_reports`: A list of objects containing spool data that has + yet to be reported to Spoolman. +- `spool_id`: The current Spool ID. Can be an integer value or `null`. + #### Set active spool Set the ID of the spool that Moonraker should report usage to Spoolman of. @@ -7045,6 +7084,23 @@ See the [Spoolman API](#spoolman-apis) for more information. } ``` +#### Spoolman Status Changed + +Moonraker will emit the `notify_spoolman_status_changed` event when the +connection state to the Spoolman service has changed: + +```json +{ + "jsonrpc": "2.0", + "method": "notify_spoolman_status_changed", + "params": [ + { + "spoolman_connected": false + } + ] +} +``` + #### Agent Events Moonraker will emit the `notify_agent_event` notification when it an agent event is received.