romain-nio
romain-nio

Reputation: 1205

XDMP-BADCHAR : Unexpected character found '\"'

I tried to launch the following Xquery query via the API (I followed the link : https://docs.marklogic.com/8.0/REST/POST/v1/eval).

It works with the basic example, but when I try with a query to extract data from ML and save them to the disk, I have the following error:

{"errorResponse":{"statusCode":500, "status":"Internal Server Error", "messageCode":"XDMP-BADCHAR", "message":"XDMP-BADCHAR: (err:XPST0003) Unexpected character found '\"' (0x0022)", "messageDetail":{"messageTitle":"Unexpected character found"}}}

My xquery file contains :

xquery=
xquery version "1.0-ml";
xdmp:save("toto.csv",let $nl := "
" return document { for $book in collection("book")/optIns where root($book)/duplicate eq false() return (root($book)/contactId||","|| root($book)/countryCode||$optin/updatedDate||$nl)})

Thanks, Romain.

Upvotes: 0

Views: 578

Answers (1)

kcoleman
kcoleman

Reputation: 666

You probably have something in your query text that needs to be URL encoded. Try using --data-urlencode instead of -d, or otherwise URL-encode your form values before passing them to curl.

Upvotes: 3

Related Questions