docs: fix remote API JSON formatting and url(s)

"Delete a webcam" section contained a wrong url. Some response examples were wrapped in result, and some others were not. I've removed "result": { } for consistency. Finally I've removed many leading commas causing problems with JSON deserialization.

Signed-off-by: David Zwart <davidzwa@gmail.com>
This commit is contained in:
David Zwart 2024-03-24 12:02:33 +01:00 committed by Eric Callahan
parent c857e1a99f
commit 763d987309
1 changed files with 310 additions and 328 deletions

View File

@ -262,7 +262,7 @@ Returns:
An object containing various fields that report server state. An object containing various fields that report server state.
```json ```json
{ {
"klippy_connected": true, "klippy_connected": true,
"klippy_state": "ready", "klippy_state": "ready",
"components": [ "components": [
@ -288,7 +288,7 @@ An object containing various fields that report server state.
"moonraker_version": "v0.7.1-105-ge4f103c", "moonraker_version": "v0.7.1-105-ge4f103c",
"api_version": [1, 0, 0], "api_version": [1, 0, 0],
"api_version_string": "1.0.0" "api_version_string": "1.0.0"
} }
``` ```
!!! warning !!! warning
This object also includes `plugins` and `failed_plugins` fields that This object also includes `plugins` and `failed_plugins` fields that
@ -328,7 +328,6 @@ included.
```json ```json
{ {
{
"config": { "config": {
"server": { "server": {
"host": "0.0.0.0", "host": "0.0.0.0",
@ -483,7 +482,6 @@ included.
] ]
} }
] ]
}
} }
``` ```
@ -529,7 +527,7 @@ Note that when the host starts each array is initialized to 0s.
"temperature_fan my_fan": { "temperature_fan my_fan": {
"temperatures": [21.05, 21.12, 21.1, 21.1, 21.1], "temperatures": [21.05, 21.12, 21.1, 21.1, 21.1],
"targets": [0, 0, 0, 0, 0], "targets": [0, 0, 0, 0, 0],
"speeds": [0, 0, 0, 0, 0], "speeds": [0, 0, 0, 0, 0]
}, },
"temperature_sensor my_sensor": { "temperature_sensor my_sensor": {
"temperatures": [21.05, 21.12, 21.1, 21.1, 21.1] "temperatures": [21.05, 21.12, 21.1, 21.1, 21.1]
@ -550,7 +548,8 @@ JSON-RPC request:
"params": { "params": {
"count": 100 "count": 100
}, },
"id": 7643} "id": 7643
}
``` ```
The `count` argument is optional, limiting number of returned items The `count` argument is optional, limiting number of returned items
@ -804,7 +803,7 @@ The full JSON-RPC response.
"klipper_path": "/home/pi/klipper", "klipper_path": "/home/pi/klipper",
"python_path": "/home/pi/klippy-env/bin/python", "python_path": "/home/pi/klippy-env/bin/python",
"log_file": "/tmp/klippy.log", "log_file": "/tmp/klippy.log",
"config_file": "/home/pi/printer.cfg", "config_file": "/home/pi/printer.cfg"
} }
} }
``` ```
@ -976,7 +975,7 @@ An object where the top level items are "eventtime" and "status". The
"homing_origin": [0, 0, 0, 0], "homing_origin": [0, 0, 0, 0],
"position": [0, 0, 0, 0], "position": [0, 0, 0, 0],
"speed": 1500, "speed": 1500,
"speed_factor": 1, "speed_factor": 1
}, },
"toolhead": { "toolhead": {
"position": [0, 0, 0, 0], "position": [0, 0, 0, 0],
@ -2323,7 +2322,7 @@ A list of objects, where each object contains file data.
"modified": 1615768477.5133543, "modified": 1615768477.5133543,
"size": 189713016, "size": 189713016,
"permissions": "rw" "permissions": "rw"
}, }
] ]
``` ```
@ -2620,7 +2619,7 @@ following format:
"size": 2388774, "size": 2388774,
"permissions": "rw", "permissions": "rw",
"filename": "CE2_calicat.gcode" "filename": "CE2_calicat.gcode"
}, }
], ],
"disk_usage": { "disk_usage": {
"total": 7522213888, "total": 7522213888,
@ -2662,7 +2661,6 @@ Returns: Information about the created directory
"modified": 1676983427.3732708, "modified": 1676983427.3732708,
"size": 4096, "size": 4096,
"permissions": "rw" "permissions": "rw"
}, },
"action": "create_dir" "action": "create_dir"
} }
@ -2746,7 +2744,6 @@ JSON-RPC request:
Returns: Information about the moved file or directory Returns: Information about the moved file or directory
```json ```json
{ {
"result": {
"item": { "item": {
"root": "gcodes", "root": "gcodes",
"path": "subdir/my_file.gcode", "path": "subdir/my_file.gcode",
@ -2759,7 +2756,6 @@ Returns: Information about the moved file or directory
"root": "gcodes" "root": "gcodes"
}, },
"action": "move_file" "action": "move_file"
}
} }
``` ```
@ -3823,7 +3819,7 @@ JSON-RPC request:
"method": "server.job_queue.delete_job", "method": "server.job_queue.delete_job",
"params": { "params": {
"job_ids": [ "job_ids": [
"0000000066D991F0". "0000000066D991F0",
"0000000066D99D80" "0000000066D99D80"
] ]
}, },
@ -3966,7 +3962,7 @@ JSON-RPC request:
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "server.job_queue.jump", "method": "server.job_queue.jump",
"params" { "params": {
"job_id": "0000000066D991F0" "job_id": "0000000066D991F0"
}, },
"id": 4654 "id": 4654
@ -4036,7 +4032,6 @@ sorted by `date` and a list of feeds Moonraker is currently subscribed to:
```json ```json
{ {
{
"entries": [ "entries": [
{ {
"entry_id": "arksine/moonlight/issue/3", "entry_id": "arksine/moonlight/issue/3",
@ -4095,7 +4090,6 @@ sorted by `date` and a list of feeds Moonraker is currently subscribed to:
"moonlight" "moonlight"
] ]
} }
}
``` ```
#### Update announcements #### Update announcements
@ -4569,7 +4563,7 @@ The full configuration for the added/updated webcam:
HTTP request: HTTP request:
```http ```http
DELETE /server/webcams/uid?name=341778f9-387f-455b-8b69-ff68442d41d9 DELETE /server/webcams/item?uid=341778f9-387f-455b-8b69-ff68442d41d9
``` ```
JSON-RPC request: JSON-RPC request:
```json ```json
@ -4870,7 +4864,7 @@ and `fluidd` are present as clients configured in `moonraker.conf`
"subject": "stm32: Wait for transmission to complete before returning from spi_transfer()", "subject": "stm32: Wait for transmission to complete before returning from spi_transfer()",
"message": "It's possible for the SCLK pin to still be updating even after the\nlast byte of data has been read from the receive pin. (In particular\nin spi mode 0 and 1.) Exiting early from spi_transfer() in this case\ncould result in the CS pin being raised before the final updates to\nSCLK pin.\n\nAdd an additional wait at the end of spi_transfer() to avoid this\nissue.\n\nSigned-off-by: Kevin O'Connor <kevin@koconnor.net>", "message": "It's possible for the SCLK pin to still be updating even after the\nlast byte of data has been read from the receive pin. (In particular\nin spi mode 0 and 1.) Exiting early from spi_transfer() in this case\ncould result in the CS pin being raised before the final updates to\nSCLK pin.\n\nAdd an additional wait at the end of spi_transfer() to avoid this\nissue.\n\nSigned-off-by: Kevin O'Connor <kevin@koconnor.net>",
"tag": null "tag": null
}, }
], ],
"git_messages": [], "git_messages": [],
"full_version_string": "v0.10.0-1-g4c8d24ae-shallow", "full_version_string": "v0.10.0-1-g4c8d24ae-shallow",
@ -4878,7 +4872,7 @@ and `fluidd` are present as clients configured in `moonraker.conf`
"recovery_url": "https://github.com/Klipper3d/klipper.git", "recovery_url": "https://github.com/Klipper3d/klipper.git",
"remote_url": "https://github.com/Klipper3d/klipper.git", "remote_url": "https://github.com/Klipper3d/klipper.git",
"warnings": [], "warnings": [],
"anomalies": [], "anomalies": []
} }
} }
} }
@ -5228,7 +5222,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"machine.device_power.devices", "method": "machine.device_power.devices",
"id": 5646 "id": 5646
} }
``` ```
@ -5411,7 +5405,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"machine.wled.strips", "method": "machine.wled.strips",
"id": 7123 "id": 7123
} }
``` ```
@ -5420,7 +5414,6 @@ Returns:
Strip information for all wled strips. Strip information for all wled strips.
```json ```json
{ {
"result": {
"strips": { "strips": {
"lights": { "lights": {
"strip": "lights", "strip": "lights",
@ -5443,7 +5436,6 @@ Strip information for all wled strips.
"error": null "error": null
} }
} }
}
} }
``` ```
@ -5456,7 +5448,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"machine.wled.status", "method": "machine.wled.status",
"params": { "params": {
"lights": null, "lights": null,
"desk": null "desk": null
@ -5469,7 +5461,6 @@ Returns:
Strip information for requested strips. Strip information for requested strips.
```json ```json
{ {
"result": {
"lights": { "lights": {
"strip": "lights", "strip": "lights",
"status": "on", "status": "on",
@ -5490,7 +5481,6 @@ Strip information for requested strips.
"speed": -1, "speed": -1,
"error": null "error": null
} }
}
} }
``` ```
@ -5505,7 +5495,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"machine.wled.on", "method": "machine.wled.on",
"params": { "params": {
"lights": null, "lights": null,
"desk": null "desk": null
@ -5518,7 +5508,6 @@ Returns:
Strip information for requested strips. Strip information for requested strips.
```json ```json
{ {
"result": {
"lights": { "lights": {
"strip": "lights", "strip": "lights",
"status": "on", "status": "on",
@ -5539,7 +5528,6 @@ Strip information for requested strips.
"speed": -1, "speed": -1,
"error": null "error": null
} }
}
} }
``` ```
@ -5554,7 +5542,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"machine.wled.off", "method": "machine.wled.off",
"params": { "params": {
"lights": null, "lights": null,
"desk": null "desk": null
@ -5567,7 +5555,6 @@ Returns:
The new state of the specified strips. The new state of the specified strips.
```json ```json
{ {
"result": {
"lights": { "lights": {
"strip": "lights", "strip": "lights",
"status": "off", "status": "off",
@ -5588,7 +5575,6 @@ The new state of the specified strips.
"speed": -1, "speed": -1,
"error": null "error": null
} }
}
} }
``` ```
@ -5597,13 +5583,13 @@ Turns each strip off if it is on and on if it is off.
HTTP request: HTTP request:
```http ```http
POST /machine/wled/off?strip1&strip2 POST /machine/wled/toggle?strip1&strip2
``` ```
JSON-RPC request: JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"machine.wled.toggle", "method": "machine.wled.toggle",
"params": { "params": {
"lights": null, "lights": null,
"desk": null "desk": null
@ -5616,7 +5602,6 @@ Returns:
The new state of the specified strips. The new state of the specified strips.
```json ```json
{ {
"result": {
"lights": { "lights": {
"strip": "lights", "strip": "lights",
"status": "on", "status": "on",
@ -5637,7 +5622,6 @@ The new state of the specified strips.
"speed": -1, "speed": -1,
"error": null "error": null
} }
}
} }
``` ```
@ -5680,9 +5664,9 @@ Returns information for the specified strip.
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"machine.wled.get_strip", "method": "machine.wled.get_strip",
"params": { "params": {
"strip": "lights", "strip": "lights"
}, },
"id": 7128 "id": 7128
} }
@ -5692,7 +5676,7 @@ Calls the action with the arguments for the specified strip.
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"machine.wled.post_strip", "method": "machine.wled.post_strip",
"params": { "params": {
"strip": "lights", "strip": "lights",
"action": "on", "action": "on",
@ -5719,7 +5703,6 @@ Returns:
State of the strip. State of the strip.
```json ```json
{ {
"result": {
"lights": { "lights": {
"strip": "lights", "strip": "lights",
"status": "on", "status": "on",
@ -5730,7 +5713,6 @@ State of the strip.
"speed": 255, "speed": 255,
"error": null "error": null
} }
}
} }
``` ```
@ -5746,7 +5728,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"server.sensors.list", "method": "server.sensors.list",
"id": 5646 "id": 5646
} }
``` ```
@ -6353,7 +6335,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"server.history.list", "method": "server.history.list",
"params":{ "params":{
"limit": 50, "limit": 50,
"start": 10, "start": 10,
@ -6407,7 +6389,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"server.history.totals", "method": "server.history.totals",
"id": 5656 "id": 5656
} }
``` ```
@ -6469,7 +6451,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"server.history.get_job", "method": "server.history.get_job",
"params":{"uid": "{uid}"}, "params":{"uid": "{uid}"},
"id": 4564 "id": 4564
} }
@ -6554,7 +6536,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"server.mqtt.publish", "method": "server.mqtt.publish",
"params":{ "params":{
"topic": "home/test/pub", "topic": "home/test/pub",
"payload": "hello", "payload": "hello",
@ -6616,7 +6598,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"server.mqtt.subscribe", "method": "server.mqtt.subscribe",
"params":{ "params":{
"topic": "home/test/sub", "topic": "home/test/sub",
"qos": 0, "qos": 0,
@ -6674,7 +6656,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"server.extensions.list", "method": "server.extensions.list",
"id": 4564 "id": 4564
} }
``` ```
@ -6718,7 +6700,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"server.extensions.request", "method": "server.extensions.request",
"params":{ "params":{
"agent": "moonagent", "agent": "moonagent",
"method": "moontest.hello_world", "method": "moontest.hello_world",
@ -6754,7 +6736,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"connection.send_event", "method": "connection.send_event",
"params":{ "params":{
"event": "my_event", "event": "my_event",
"data": {"my_arg": "optional data"} "data": {"my_arg": "optional data"}
@ -6795,7 +6777,7 @@ JSON-RPC request:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"connection.register_remote_method", "method": "connection.register_remote_method",
"params": { "params": {
"method_name": "firemon_alert_heated" "method_name": "firemon_alert_heated"
} }
@ -6849,7 +6831,7 @@ the agent will receive the following:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"firemon_alert_heated", "method": "firemon_alert_heated",
"params": { "params": {
"heater": "extruder", "heater": "extruder",
"temp": 200 "temp": 200
@ -6863,7 +6845,7 @@ receive the following:
```json ```json
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method":"monitor_alert_heated" "method": "monitor_alert_heated"
} }
``` ```