REST returning custom query output
I have some content stored on external DBs that I would like to be accessed from the browser (JSON).
It would be great to use the REST service, by adding the ability to return the output of custom queries. This way I could reuse the authentication and parameter handling already developed.
Possible through macro query and custom macro method
Yes, see http://devnet.kentico.com/docs/7_0rc/devguide/index.html?rest_data_retrieval_methods.htm, in particular:
Evaluates the given macro expression (without the encapsulating character sequence and with forbidden characters URL-encoded) and serializes the result:
~/rest/macro/<expression>, e.g. ~/rest/macro/CurrentSite.SiteName
Emanuele Firmani commented
So I can publish a REST operation that returns the output of a macro?
Hi, you can use macro as a query, so for custom query, you can register your own macro method. We don't want to make it just query based, because the query doesn't have to be select query, and the engine would have less control over it.