<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I have some administrative operations I would like to add, via an additional plugin (OTP application), to a RabbitMQ instance. I have reasonably successful writing a few generic plugins, which as I understand it are basically just OTP applications that have been registered with RabbitMQ, but I am having some difficulty fully understanding how to interface with mochiweb to add operations to the REST API. (I am less interested in making changes to the WebUI, but understanding how to do that would be a bonus.)</div><div><br></div><div>So far, I have copied the rabbitmq_shovel_management plugin (using the 3.1.5 branch on rabbitmq-public-umbrella), as a guide, and I have managed to insert my own dummy code for get operations, and I can do an HTTP GET to get the data that the plugin is providing, e.g., via</div><div><br></div><div><div><font face="Courier New">%%--------------------------------------------------------------------</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">init(_Config) -> {ok, #context{}}.</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">content_types_provided(ReqData, Context) -></font></div><div><font face="Courier New"> {[{"application/json", to_json}], ReqData, Context}.</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">to_json(ReqData, Context) -></font></div><div><font face="Courier New"> rabbit_mgmt_util:reply(status(), ReqData, Context).</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">is_authorized(ReqData, Context) -></font></div><div><font face="Courier New"> rabbit_mgmt_util:is_authorized_admin(ReqData, Context).</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">%%--------------------------------------------------------------------</font></div><div><font face="Courier New"><br></font></div><div><font face="Courier New">status() -></font></div><div><font face="Courier New"><span class="Apple-tab-span" style="white-space:pre">        </span>[{name, <<"foo">>}, {node, <<"bar">>} ].</font></div></div><div><br></div><div>I am now interested in using PUT and POST operations to pass parameters to allow state mutation on the server (a la REST principles).</div><div><br></div><div>I don't suppose there is any documentation on anything more than the metronome sample plugin. Is there a simple example to follow, in the umbrella code, that would give me an architectural understanding of how the rabbit_mgmt_extension behavior can be leveraged?</div><div><br></div><div>Short of that, can anyone explain the roles of the following functions?</div><div><br></div><div>content_types_provided/2</div><div>resource_exists/2</div><div>to_json/2</div><div>is_authorized/2</div><div><br></div><div>augmented/2</div><div>basic/1</div><div><br></div><div>Who calls them? When are they called? Can anything general be said about the parameters to these functions? (Yes, I too can use io:format :)</div><div><br></div><div>Sorry for the somewhat vague set of questions, but I haven't gotten cozy with mochiweb (though I have done some work with YAWS), so I am just hunting for a few pointers.</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>-Fred</div></body></html>