From c9aafb2b642b14bd5c0d5833ebe87e2bc999a990 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 4 Jun 2015 00:22:18 +0100 Subject: [PATCH] Updated README --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d91871b..9b0af8c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Stabber acts as a stubbed XMPP service for testing purposes, the API allows: * Responding to XMPP stanzas with stubbed responses, by id, and by query namespace * Verifying that XMPP stanzas were received. -An HTTP API is also included, currently only supporting the `stbbr_send` and `stbbr_for_id` operations. +An HTTP API is also included, currently only supporting the `stbbr_send`, `stbbr_for_id` and `stbbr_for_query` operations. The project is work in progress with only the basics implemented, and is being developed alongside https://github.com/boothj5/profanity Currently the only API is written in C. @@ -135,15 +135,21 @@ stabber -p 5230 -h 5231 ``` The second argument is the HTTP port on which Stabber will listen. +### Sending stanzas To send a message to a client currently connected to Stabber on port 5230, send a POST request to `http://localhost:5231/send` with the body containing the stanza to send, e.g.: ``` curl --data 'Here is a message sent from stabber, using the HTTP api' http://localhost:5231/send ``` +### Responding to stanzas To respond to a stanza with a specfic id sent from the client, send a POST request to `http://localhost:5231/for?id=` where `` is the the id you wish to respond to, e.g.: ``` curl --data 'heres my answer!' http://localhost:5231/for?id=prof_msg_1 ``` +To respond to a stanza with a specfic query namespace sent from the client, send a POST request to `http://localhost:5231/for?query=` where `` is the the query namespace you wish to respond to, e.g.: +``` +curl --data '' http://localhost:5231/for?query=jabber:iq:roster +``` # Examples Example tests for Profanity can be found at: https://github.com/boothj5/profanity/tree/stabber-tests/functionaltests