diff --git a/doc/http_post.md b/doc/http_post.md index 97cec2a07..d77aa9329 100644 --- a/doc/http_post.md +++ b/doc/http_post.md @@ -70,6 +70,12 @@ User ability to post is based on node configuration. User ability to post is based on node configuration. +### Deleting an item ### + + $ curl -u jid:password -i -X DELETE http://post:port/pshb/domain/node/itemid + +User ability to post is based on node configuration. + ### Creating a new node ### diff --git a/src/web/pshb_http.erl b/src/web/pshb_http.erl index 0b48b378d..f7967b285 100644 --- a/src/web/pshb_http.erl +++ b/src/web/pshb_http.erl @@ -116,6 +116,14 @@ out(Args, 'POST', [_D, _Node]=Uri, {_User, _Domain} = UD) -> out(Args, 'PUT', [_D, _Node, Slug]=Uri, {_User, _Domain} = UD) -> publish_item(Args, Uri, Slug, UD); +out(Args, 'DELETE', [_D, Node, Id]= Uri, {User, UDomain}) -> + Host = get_host(Uri), + Jid = jlib:make_jid({User, UDomain, ""}), + case mod_pubsub:delete_item(get_host(Uri), list_to_binary(Node), Jid, Id) of + {error, Error} -> error(Error); + {result, Res} -> success(200) + end; + out(Args, 'PUT', [_Domain, Node]= Uri, {User, UDomain}) -> Host = get_host(Uri),