Skip to content

Commit d59d1e5

Browse files
committed
docs: document new "notify_metadata_update" notification
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
1 parent 28977bd commit d59d1e5

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

docs/api_changes.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
11
This document keeps a record of all changes to Moonraker's remote
22
facing APIs.
33

4-
### August 16 2020
4+
### September 1st 2020
5+
- A new notification has been added: `notify_metdata_update`. This
6+
notification is sent when Moonraker parses metdata from a new upload.
7+
Note that the upload must be made via the API, files manually (using
8+
SAMBA, SCP, etc) do not trigger a notification. The notification is
9+
sent in the following format:
10+
```
11+
{jsonrpc: "2.0", method: "notify_metadata_update", params: [metadata]}
12+
```
13+
Where `metadata` is an object in the following format:
14+
15+
```json
16+
{
17+
filename: "file name",
18+
size: <file size>,
19+
modified: "last modified date",
20+
slicer: "Slicer Name",
21+
first_layer_height: <in mm>,
22+
layer_height: <in mm>,
23+
object_height: <in mm>,
24+
estimated_time: <time in seconds>,
25+
filament_total: <in mm>,
26+
thumbnails: [
27+
{
28+
width: <in pixels>,
29+
height: <in pixels>,
30+
size: <length of string>,
31+
data: <base64 string>
32+
}, ...
33+
]
34+
}
35+
```
36+
37+
### August 16th 2020
538
- The structure of data returned from `/printer/info` (`get_printer_info`)
639
has changed to the following format:
740
```json

docs/web_api.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,36 @@ The following `actions` are currently available:
747747
- `move_item`
748748
- `copy_item`
749749

750+
### Metadata Update
751+
When a new file is uploaded via the API a websocket notification is broadcast
752+
to all connected clients after parsing is complete:
753+
754+
`{jsonrpc: "2.0", method: "notify_metadata_update", params: [metadata]}`
755+
756+
Where `metadata` is an object in the following format:
757+
758+
```json
759+
{
760+
filename: "file name",
761+
size: <file size>,
762+
modified: "last modified date",
763+
slicer: "Slicer Name",
764+
first_layer_height: <in mm>,
765+
layer_height: <in mm>,
766+
object_height: <in mm>,
767+
estimated_time: <time in seconds>,
768+
filament_total: <in mm>,
769+
thumbnails: [
770+
{
771+
width: <in pixels>,
772+
height: <in pixels>,
773+
size: <length of string>,
774+
data: <base64 string>
775+
}, ...
776+
]
777+
}
778+
```
779+
750780
# Appendix
751781

752782
### Websocket setup

0 commit comments

Comments
 (0)