Wow, clicked send before I meant to. The last line was a copy from the table in the documentation and the last column has "document-node()" which seems to suggest that getting a map(*) there isn't possible. So not sure what is supposed to happen.
Anyway I would think that correct behaviour would be, I think, to deliver a map(*) to the function instead of a document-node() in this case.
Maybe something to forward to Adam Retter / RESTXQ?
--Marc
On Mon, Aug 3, 2015 at 4:54 PM, Marc van Grootel marc.van.grootel@gmail.com wrote:
Hi Christian,
No luck.
I'm using Postman. I already had Content-Type = application/json and Accept = application/json. I tried changing it to application/json;format=map (btw do you think it's necessary to have the basex/restxq specific pseudo attributes (format= etc) in the HTTP request headers?)
I'm seeing 400 errors like this:
[bxerr:BASX0003] Input could not be converted: "POST.xml" (Line 1): No text allowed before root element.
So something is different now but still there seems to be an expectation somewhere on the post being XML at least the filename suggests so.
The documentation is a bit contradictory:
"The body of a POST or PUT request will be converted to an XQuery
item. Conversion can be controlled by specifying a content type. It can be further influenced by specifying additional content-type parameters:"
The table below lists:
application/jsonJSON Optionsdocument-node()
On Mon, Aug 3, 2015 at 4:42 PM, Christian GrĂ¼n christian.gruen@gmail.com wrote:
Hi Marc,
declare %rest:POST("{$body}") %rest:path("/json") %rest:consumes("application/json;lax=yes;format=map") %rest:produces("application/json;format=map")
If I remember right, content-type parameters in rest annotations will be ignored, because these annotations only serve as filters. Instead, you will need to specify the content-type parameters client-side (in your POST or PUT request).
Hope this helps, Christian
-- --Marc