I see that REST GET request supports the ?run=foo.xq style, which allows a GET to be handled by a pre-defined XQuery file. See http://docs.basex.org/wiki/REST#GET_Requests
However, the REST POST (and other) requests do not support it.
You may be gratified to hear that POST also supports the RUN operation. I've added a small example to the documentation:
http://docs.basex.org/wiki/REST#POST_Requests
With support for XUpdate in BaseX, it is important to have the ability to POST (or PUT) application-defined data to a server-side XQuery, rather than having the client have to post the entire query.
This is possible by adding a rest:context/ element to your POST request. The element contents will then available as the context item of the server-side query; e.g.:
<rest:run xmlns:rest="http://www.basex.org/rest%22%3E rest:textquery.xq</rest:text> rest:context <xml> <text>Hello</text> <text>World</text> </xml> </rest:context> </rest:run>
Hope this helps, Christian