Diff

mod_rest/README.markdown @ 4477:8df6cc648963

mod_rest: Add more REST-looking way to send stanzas Example: POST /rest/message/chat/juliet@example.net { body: "Hello" } Becomes equivalent to POST /rest { kind: "message", type: "chat", to: "juliet@example.net", body: "Hello" } Sending messages as plain/text also becomes more convenient. IQ stazas are still weird, but we'll do something special for those.
author Kim Alvefur <zash@zash.se>
date Sun, 28 Feb 2021 19:25:45 +0100
parent 4275:bb111148d031
child 4478:7ab0c423688a
line wrap: on
line diff
--- a/mod_rest/README.markdown	Sun Feb 28 18:55:18 2021 +0100
+++ b/mod_rest/README.markdown	Sun Feb 28 19:25:45 2021 +0100
@@ -70,6 +70,18 @@
 
 The `Content-Type` header is important!
 
+### Parameters in path
+
+New alternative format with the parameters `kind`, `type`, and `to`
+embedded in the path:
+
+```
+curl https://prosody.example:5281/rest/message/chat/john@example.com \
+    --oauth2-bearer dmVyeSBzZWNyZXQgdG9rZW4K \
+    -H 'Content-Type: text/plain' \
+    --data-binary 'Hello John!'
+```
+
 ### Replies
 
 A POST containing an `<iq>` stanza automatically wait for the reply,