Skip to content

Commit

Permalink
docs: document new "notify_metadata_update" notification
Browse files Browse the repository at this point in the history
Signed-off-by:  Eric Callahan <[email protected]>
  • Loading branch information
Arksine committed Sep 1, 2020
1 parent 28977bd commit d59d1e5
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
35 changes: 34 additions & 1 deletion docs/api_changes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
This document keeps a record of all changes to Moonraker's remote
facing APIs.

### August 16 2020
### September 1st 2020
- A new notification has been added: `notify_metdata_update`. This
notification is sent when Moonraker parses metdata from a new upload.
Note that the upload must be made via the API, files manually (using
SAMBA, SCP, etc) do not trigger a notification. The notification is
sent in the following format:
```
{jsonrpc: "2.0", method: "notify_metadata_update", params: [metadata]}
```
Where `metadata` is an object in the following format:

```json
{
filename: "file name",
size: <file size>,
modified: "last modified date",
slicer: "Slicer Name",
first_layer_height: <in mm>,
layer_height: <in mm>,
object_height: <in mm>,
estimated_time: <time in seconds>,
filament_total: <in mm>,
thumbnails: [
{
width: <in pixels>,
height: <in pixels>,
size: <length of string>,
data: <base64 string>
}, ...
]
}
```

### August 16th 2020
- The structure of data returned from `/printer/info` (`get_printer_info`)
has changed to the following format:
```json
Expand Down
30 changes: 30 additions & 0 deletions docs/web_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,36 @@ The following `actions` are currently available:
- `move_item`
- `copy_item`

### Metadata Update
When a new file is uploaded via the API a websocket notification is broadcast
to all connected clients after parsing is complete:

`{jsonrpc: "2.0", method: "notify_metadata_update", params: [metadata]}`

Where `metadata` is an object in the following format:

```json
{
filename: "file name",
size: <file size>,
modified: "last modified date",
slicer: "Slicer Name",
first_layer_height: <in mm>,
layer_height: <in mm>,
object_height: <in mm>,
estimated_time: <time in seconds>,
filament_total: <in mm>,
thumbnails: [
{
width: <in pixels>,
height: <in pixels>,
size: <length of string>,
data: <base64 string>
}, ...
]
}
```

# Appendix

### Websocket setup
Expand Down

0 comments on commit d59d1e5

Please sign in to comment.