Mercurial > prosody-modules
comparison mod_rest/README.markdown @ 3857:8752e5b5dd08
mod_rest/README: Add a section describing the JSON mapping
Mostly complete
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Jan 2020 01:31:49 +0100 |
parents | a8aa11cc351d |
children | 117a979ef930 |
comparison
equal
deleted
inserted
replaced
3856:8bdb1729529b | 3857:8752e5b5dd08 |
---|---|
281 ``` | 281 ``` |
282 | 282 |
283 Remember to set `rest_callback_content_type = "application/json"` for | 283 Remember to set `rest_callback_content_type = "application/json"` for |
284 this to work. | 284 this to work. |
285 | 285 |
286 # JSON mapping | |
287 | |
288 This section describes the JSON mapping. It can't represent any possible | |
289 stanza, for full flexibility use the XML mode. | |
290 | |
291 ## Stanza basics | |
292 | |
293 `kind` | |
294 : String representing the kind of stanza, one of `"message"`, | |
295 `"presence"` or `"iq"`. | |
296 | |
297 `type` | |
298 : String with the type of stanza, appropriate values vary depending on | |
299 `kind`, see [RFC 6121]. E.g.`"chat"` for *message* stanzas etc. | |
300 | |
301 `to` | |
302 : String containing the XMPP Address of the destination / recipient of | |
303 the stanza. | |
304 | |
305 `from` | |
306 : String containing the XMPP Address of the sender the stanza. | |
307 | |
308 `id` | |
309 : String with a reasonably unique identifier for the stanza. | |
310 | |
311 ## Basic Payloads | |
312 | |
313 ### Messages | |
314 | |
315 `body` | |
316 : String, human readable text message. | |
317 | |
318 `subject` | |
319 : String, human readable summary equivalent to an email subject or the | |
320 chat room topic in a `type:groupchat` message. | |
321 | |
322 ### Presence | |
323 | |
324 `show` | |
325 : String representing availability, e.g. `"away"`, `"dnd"`. No value | |
326 means a normal online status. See [RFC 6121] for the full list. | |
327 | |
328 `status` | |
329 : String with a human readable text message describing availability. | |
330 | |
331 ## More payloads | |
332 | |
333 ### Messages | |
334 | |
335 `state` | |
336 : String with current chat state, e.g. `"active"` (default) and | |
337 `"composing"` (typing). | |
338 | |
339 `html` | |
340 : String with HTML allowing rich formating. **MUST** be contained in a | |
341 `<body>` element. | |
342 | |
343 `oob_url` | |
344 : String with an URL of an external resource. | |
345 | |
346 ### Presence | |
347 | |
348 `join` | |
349 : Boolean, used to join group chats. | |
350 | |
351 ### IQ | |
352 | |
353 `ping` | |
354 : Boolean, a simple ping query. "Pongs" have only basic fields | |
355 presents. | |
356 | |
357 `version` | |
358 : Map with `name`, `version` fields, and optionally an `os` field, to | |
359 describe the software. | |
360 | |
361 #### Service Discovery | |
362 | |
363 `disco` | |
364 | |
365 : Boolean `true` in a `kind:iq` `type:get` for a service discovery | |
366 query. | |
367 | |
368 Responses have a map containing an array of available features in | |
369 the `features` key and an array of "identities" in the `identities` | |
370 key. Each identity has a `category` and `type` field as well as an | |
371 optional `name` field. See [XEP-0030] for further details. | |
372 | |
373 `items` | |
374 : Boolean `true` in a `kind:iq` `type:get` for a service discovery | |
375 items list query. The response contain an array of items like | |
376 `{"jid":"xmpp.address.here","name":"Description of item"}`. | |
377 | |
286 # Compatibility | 378 # Compatibility |
287 | 379 |
288 Requires Prosody trunk / 0.12 | 380 Requires Prosody trunk / 0.12 |