2010-09-07 11:32:14 +02:00
# Managing pubsub nodes through HTTP Atompub #
## Configuration ##
These options will be used by the service to know how to build URLs. Using the previous configuration items the service should be accessed through `http://notify.push.bbc.co.uk:5280/pshb/<host>/<node>/` .
Also, in the ejabberd_http handler configuration, add the identified line.
{5280, ejabberd_http, [
http_poll,
web_admin,
{request_handlers, [{["pshb"], pshb_http}]} % this should be added
]}
2010-09-07 14:35:40 +02:00
## Important notice ##
In the current version of the code, some security checks are not done :
* read operations can all be done without authentication
* node creation uses the default `all` access_createnode acl, not checking for the actual configuration.
2010-09-07 11:32:14 +02:00
## Usage example with cURL ##
### Getting the service document ###
No authentication necessary. All nodes are listed.
2010-09-07 14:35:40 +02:00
curl -i http://host:port/pshb/domain/
2010-09-07 11:32:14 +02:00
### Getting items from a node ###
No authentication done, and all nodes are accessible.
2010-09-07 14:35:40 +02:00
curl -i http://host:port/pshb/domain/node/
2010-09-07 11:32:14 +02:00
### Posting a new item ###
2010-09-07 14:35:40 +02:00
curl -u jid:password -i -X POST -d @entry .atom http://post:port/pshb/domain/node
2010-09-07 11:32:14 +02:00
User ability to post is based on node configuration.
### Creating a new node ###
2010-09-07 14:35:40 +02:00
An instant node can be created if server configuration allows:
2010-09-07 11:32:14 +02:00
curl -X POST -u cstar@localhost:encore -d "" http://localhost:5280/pshb/localhost
2010-09-07 14:35:40 +02:00
or
curl -X POST -u cstar@localhost:encore -d "< pubsub > < create node = 'princely_musings' / > < / pubsub > " http://localhost:5280/pshb/localhost
configure element (as per XEP-60) can be passed in the pubsub body.
$ cat createnode.xml
< pubsub > < create node = 'princely_musings' type = 'flat' / >
< x xmlns = 'jabber:x:data' type = 'submit' >
< field var = 'FORM_TYPE' type = 'hidden' >
< value > http://jabber.org/protocol/pubsub#node_config< / value >
< / field >
< field var = 'pubsub#title' > < value > Princely Musings (Atom)< / value > < / field >
< field var = 'pubsub#max_payload_size' > < value > 1028< / value > < / field >
< field var = 'pubsub#type' > < value > Atom< / value > < / field >
< / x >
< / pubsub >
$ curl -X POST -u cstar@localhost:encore -d @createnode .xml http://localhost:5280/pshb/localhost
### Deleting a node ###
A node is deleted by:
curl -X DELETE -u cstar@localhost:encore http://localhost:5280/pshb/localhost/princely_musings
2010-09-07 11:32:14 +02:00