controler_api Processes authorized REST API requests: It provides an easy way to create API calls to allow computer programs to perform functions on your Zotonic site.

controller_api by default intercepts all URLs according to the patterns /api/:module/:method and the url /api/:module. See the API Services manual for more information.


See Service authentication for how authentication is done when using this controller.

Creating services at a non-standard URL

New in version 0.8.

It is possible to pre-fill the required module and method parameters so that you can use controller_api at another entry point. For instance, the following dispatch rule is valid:

{dosomething,    ["do", "something"], controller_api, [{module, "foobar"}, {method, "test"}]}

This would invoke the mod_foobar/services/service_foobar_test.erl service at the url /do/something,

Table Of Contents

Previous topic


Next topic