comparison 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
parents bb111148d031
children 7ab0c423688a
comparison
equal deleted inserted replaced
4476:125279f4a5b8 4477:8df6cc648963
67 "type" : "chat" 67 "type" : "chat"
68 }' 68 }'
69 ``` 69 ```
70 70
71 The `Content-Type` header is important! 71 The `Content-Type` header is important!
72
73 ### Parameters in path
74
75 New alternative format with the parameters `kind`, `type`, and `to`
76 embedded in the path:
77
78 ```
79 curl https://prosody.example:5281/rest/message/chat/john@example.com \
80 --oauth2-bearer dmVyeSBzZWNyZXQgdG9rZW4K \
81 -H 'Content-Type: text/plain' \
82 --data-binary 'Hello John!'
83 ```
72 84
73 ### Replies 85 ### Replies
74 86
75 A POST containing an `<iq>` stanza automatically wait for the reply, 87 A POST containing an `<iq>` stanza automatically wait for the reply,
76 long-polling style. 88 long-polling style.