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.
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. DELETE is useful as well, but takes on data.
See http://docs.basex.org/wiki/REST#POST_Requests
I took a quick look at RESTPost.java and RESTGet.java and see that it would be about 50 lines of work to make RESTPost support making the request entity available to the specified XQuery as context.
Leigh.