Mercurial > prosody-wiki
diff mod_data_access.wiki @ 249:963ae0ff05b0
Add page for mod_mam
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 06 Jan 2012 16:52:20 +0100 |
parents | c6f01319f4c3 |
children |
line wrap: on
line diff
--- a/mod_data_access.wiki Fri Jan 06 11:32:52 2012 +0000 +++ b/mod_data_access.wiki Fri Jan 06 16:52:20 2012 +0100 @@ -10,11 +10,10 @@ {{{ GET /data[/<host>/<user>]/<store>[/<format>] HTTP/1.1 Authorization: <base64(authzid:password)> - [Host: <host>] -- OR -- - PUT|POST /data[/<host>/<user>]/<store>[/<format>] HTTP/1.1 + PUT|POST /data[/<host>/<user>]/<store> HTTP/1.1 Content-Type: text/x-lua | application/json <data> @@ -34,8 +33,35 @@ == Fields == ||*Field*||*Description*||*Default*|| -||`host`||Which virtual host to access||Required. If not set in the path, the `Host` header is used. If that's not set either, the domain-part of the authzid is used.|| +||`host`||Which virtual host to access||Required. If not set in the path, the domain-part of the authzid is used.|| ||`user`||Which users storage to access||Required. If not set in the path, uses the node part of the authzid.|| ||`store`||Which storage to access.||Required.|| ||`format`||Which format to serialize to. `json` and `lua` are supported. When uploading data, the `Content-Type` header is used.||`json`|| ||`data`||The actual data to upload in a `PUT` or `POST` request.||`nil`|| + +Note: Only admins can change data for users other than themselves. + +== Example usage == + +Here follows some example usage using `curl`. + +Get your account details: + +{{{ + curl http://prosody.local:5280/data/accounts -u user@example.com:secr1t + {"password":"secr1t"} +}}} + +Set someones account details: + +{{{ + curl -X PUT http://prosody.local:5280/data/example.com/user/accounts -u admin@host:r00tp4ssw0rd --header 'Content-Type: application/json' --data-binary '{"password":"changeme"}' +}}} + +== Client library == + +* https://metacpan.org/module/Prosody::Mod::Data::Access + +== TODO == + +* Use `Accept` header.