Hi,
I used an old version of BaseX (7.0 I think) and made HTTP GET requests to application/xquery ressources in the database which evaluated them before returning the result of the evaluation. That way I could used predefined XQuery queries stored in the database. The following sentence is written in the documentation at http://docs.basex.org/wiki/REST#Operations : "If a resource with content type application/xquery is addressed, it will be evaluated first, and the result will be returned." But it no more the case in 7.2 and instead I get the query verbatim, not the result of the evaluation.
Indeed, Googling around I even found a bug correction made by Christian Grün ( https://github.com/BaseXdb/basex-api/blob/146d594931abe0143766203a329d8f6823... ) to an old version of the code. We can see at lines 76 to 82 that an application/xquery ressource is evaluated first:
if(type.equals(MimeTypes.APP_XQUERY)) { // execute raw file as query final ArrayOutput ao = new ArrayOutput(); session.setOutputStream(ao); session.execute(new Retrieve(ctx.dbpath())); query(ao.toString(), ctx); }
Thus, I tried to find the same sort of code in the actual 7.2 version but could not. So I am wondering if this is a wanted omission, and thus the documentation is out of sync, or if it is an unwanted omission and needs to be corrected. The code I checked is at https://github.com/BaseXdb/basex-api/blob/master/src/main/java/org/basex/htt...
The workaround I used is to put my queries as files in the HTTPPATH directory found in the .basex file.
TIA for any clarification on that matter,
Ludovic Kuty