docs: Provide response_template in subscription examples in API_Server.md

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-10-17 10:58:57 -04:00
parent bfcd5536fc
commit 6b23dd9ff1
1 changed files with 4 additions and 2 deletions

View File

@ -188,7 +188,8 @@ This endpoint allows one to query and then subscribe to information
from printer objects. The endpoint request and response is identical from printer objects. The endpoint request and response is identical
to the "objects/query" endpoint. For example: to the "objects/query" endpoint. For example:
`{"id": 123, "method": "objects/subscribe", "params": `{"id": 123, "method": "objects/subscribe", "params":
{"objects":{"toolhead": ["position"], "webhooks": ["state"]}}}` {"objects":{"toolhead": ["position"], "webhooks": ["state"]},
"response_template":{}}}`
might return: might return:
`{"id": 123, "result": {"status": {"webhooks": {"state": "ready"}, `{"id": 123, "result": {"status": {"webhooks": {"state": "ready"},
"toolhead": {"position": [0.0, 0.0, 0.0, 0.0]}}, "toolhead": {"position": [0.0, 0.0, 0.0, 0.0]}},
@ -245,7 +246,8 @@ after any pending G-Code commands complete.
This endpoint is used to subscribe to G-Code terminal messages that This endpoint is used to subscribe to G-Code terminal messages that
are generated by Klipper. For example: are generated by Klipper. For example:
`{"id": 123, "method": "gcode/subscribe_output"}` `{"id": 123, "method": "gcode/subscribe_output", "params":
{"response_template":{}}}`
might later produce asynchronous messages such as: might later produce asynchronous messages such as:
`{"params": {"response": "// Klipper state: Shutdown"}}` `{"params": {"response": "// Klipper state: Shutdown"}}`