running xquery scripts in REST server

Wednesday, 17 October 2012 · 3 messages · last reply 23 Oct 2012
P
pw17 Oct 2012 10:50 #
Hello List this is a noob question: I have BaseX 7.3 set up using httpserver. I can add a script to HTTPPATH and run it using http://{server:port}/rest?run=myScript.xq However, if I add myScript.xq to a database and try to run it then [http://{server:port}/rest/DB/myScript.xq ] then all I get returned is the XQuery script itself as a text file, the query doesn't run. From the examples e.g. http://docs.basex.org/wiki/REST#GET_Requests_2 I thought that I am doing the same type of call, e,g, http://localhost:8984/rest/DB/mult.xq?a=21&b=2 What should I be doing? Many thanks Peter
MS
Michael Seiferle19 Oct 2012 12:08 #
Hi Peter, sorry I did not manage to answer you earlier :-) As a quick hint, could you please try the following: * put your query file into the filesystem as described in http://docs.basex.org/wiki/REST * Please note, that in 7.3 the variable WEBPATH has been called HTTPPATH (I hope this does not add to the confusion ;-)) Apart from that, I can only encourage you to have a look at RestXQ as it is most flexible in my opinion for running XQuery server-side and empowering not only rest service but interactive website as well. => http://docs.basex.org/wiki/RESTXQ Hope this helps! Kind Regards Michael
Quoted text · pw · 32 lines
Am 17.10.2012 um 10:50 schrieb pw at themail.co.uk: > > Hello List > > this is a noob question: > > I have BaseX 7.3 set up using httpserver. I can add a script to > HTTPPATH and run it using http://{server:port}/rest?run=myScript.xq > > However, if I add myScript.xq to a database and try to run it then > [http://{server:port}/rest/DB/myScript.xq ] then all I get returned > is the XQuery script itself as a text file, the query doesn't run. > > From the examples e.g. http://docs.basex.org/wiki/REST#GET_Requests_2 > I thought that I am doing the same type of call, e,g, > http://localhost:8984/rest/DB/mult.xq?a=21&b=2 > > What should I be doing? > > Many thanks > > Peter > > > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
CG
Christian Grünin reply to pw, 17 Oct 2012, 10:5023 Oct 2012 13:10 #
Dear Peter, thanks for your question, and sorry for the outdated example. Sime time ago, we have disabled the direct execution of query files residing in databases in order to make our simple REST interface more RESTful, i.e., reduce the number of side effects that can be caused by a REST call. I have updated the example you mentioned: it now references a file that can be placed in the HTTP (webapp) directory. Hope this helps, Christian
Quoted text · pw · 32 lines
On Wed, Oct 17, 2012 at 10:50 AM, <pw at themail.co.uk> wrote: > > Hello List > > this is a noob question: > > I have BaseX 7.3 set up using httpserver. I can add a script to > HTTPPATH and run it using http://{server:port}/rest?run=myScript.xq > > However, if I add myScript.xq to a database and try to run it then > [http://{server:port}/rest/DB/myScript.xq ] then all I get returned > is the XQuery script itself as a text file, the query doesn't run. > > From the examples e.g. http://docs.basex.org/wiki/REST#GET_Requests_2 > I thought that I am doing the same type of call, e,g, > http://localhost:8984/rest/DB/mult.xq?a=21&b=2 > > What should I be doing? > > Many thanks > > Peter > > > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery