Updating expressions using REST?

Monday, 14 April 2014 · 2 messages
FH
Fredrik Hedberg14 Apr 2014 22:49 #

Hi,

I'm having problems with updating expressions using REST.

Non-updating queries execute fine without errors but when I use updating expressions the REST service returns a 400 (bad request) error.

For instance: the following body of a POST request <run xmlns='http://basex.org/rest'><text>insertDummy.xq</text></run>

with code in file insertDummy.xq: xquery version '3.0'; insert node <structure>nada</structure> into collection("component")/structures

sent to: http://admin:admin@localhost:8984/rest/component/

returns a "(400) Bad request" error

while if I substitute the code in file insertDummy.xq for a non updating expression such as:

   xquery version '3.0';
   let $r := collection("component")/structures
   return $r

it works fine!

I suspected this was a result of user rights so I added the admin credentials to the http path. No change, problem persists. Also, I de-installed the program, made sure all files were gone, and then re-installed the (win PC) program again to wipe any weird settings I may have changed. Still no luck...

The above code did work on a previous installation (I beleive I was using 7.7.1).

Any help would be highly appriciated.

Many thanks, Fredrik Hedberg

CG
Christian Grün14 Apr 2014 23:30 #

Hi Fredrik,

I just tried our latest 8.0 snapshot [1] and the current 7.8.3-beta branch, but my little test query didn't cause any problems. Do you think you can provide us with a little self-contained example, or some steps how to reproduce the problem? You could additionally activate debugging (-d) and send us the output.

Best, Christian

Quoted text · Fredrik Hedberg · 4 lines
On Mon, Apr 14, 2014 at 10:49 PM, Fredrik Hedberg <fr_hedberg at hotmail.com> wrote: > xquery version '3.0'; > insert node <structure>nada</structure> into collection("component")/structures

⚡Generated with XQuery