docs: update for latest API additions and changes

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-10-21 15:42:03 -04:00
parent 8a6503da8a
commit 2d77400a65
2 changed files with 43 additions and 6 deletions

View File

@ -1,6 +1,14 @@
This document keeps a record of all changes to Moonraker's remote This document keeps a record of all changes to Moonraker's remote
facing APIs. facing APIs.
### October 21st 2020
- The `/server/gcode_store` endpoint no longer returns a string
in the result's `gcode_store` field. It now returns an
Array of objects, each object containing `message` and `time`
fields. The time refers to a timestamp in unix time (seconds),
and may be used to determine when the gcode store received the
accompanying `message`.
### September 30th 2020 ### September 30th 2020
- Two new endpoints have been added: - Two new endpoints have been added:
- `GET /server/info` (`server.info`) - `GET /server/info` (`server.info`)

View File

@ -233,8 +233,9 @@ that uses promises to return responses and errors (see json-rcp.js).
- HTTP command:\ - HTTP command:\
`GET /server/gcode_store` `GET /server/gcode_store`
Optionally, a `count` argument may be added to specify the number of lines fetch. Optionally, a `count` argument may be added to specify the number of
If omitted, the entire gcode store will be sent (up to 1000 lines). responses to fetch. If omitted, the entire gcode store will be sent
(up to 1000 responses).
`GET /server/gcode_store?count=100` `GET /server/gcode_store?count=100`
@ -246,14 +247,42 @@ that uses promises to return responses and errors (see json-rcp.js).
params: {count: <integer>} id: <request id>}` params: {count: <integer>} id: <request id>}`
- Returns:\ - Returns:\
An object which includes a string containing up to 1000 lines of An object with the field `gcode_store` that contains an array
stored gcode responses. Each line will be separated by a newline of objects. Each object will contain a `message` field and a
character: `time` field:
```json ```json
{ {
gcode_store: <string> gcode_store: [
{
message: <string>,
time: unix_time_stamp
}, ...
]
} }
``` ```
Each `message` field contains a gcode response received at the time
indicated in the `time` field. Note that the time stamp refers to
unix time (in seconds). This can be used to create a JavaScript
`Date` object:
```javascript
for (let resp of result.gcode_store) {
let date = new Date(resp.time * 1000);
// Do something with date and resp.message ...
}
```
### Restart Server
- HTTP command:\
`POST /server/restart`
- Websocket command:
`{jsonrpc: "2.0", method: "server.restart", id: <request id>}`
- Returns:\
`"ok"` upon receipt of the restart request. After the request
is returns, the server will restart. Any existing connection
will be disconnected. A restart will result in the creation
of a new server instance where the configuration is reloaded.
## Gcode Controls ## Gcode Controls