3
votes

I have Marklogic installed locally.

Want to set up a Rest Api Instance, so am following instructions at https://developer.marklogic.com/learn/rest/setup#create-a-rest-api-instance

I copy and paist the curl instruction, minus the backslash line continuations

curl -v -X POST  --anyauth -u admin:admin   --header "Content-Type:application/json"   -d '{"rest-api": { "name": "TutorialServer", "port": "8011", "database": "TutorialDB", "modules-database": "Tutorial-Modules" } }'   http://localhost:8002/v1/rest-apis

It runs, but the responce I get is "Your bootstrap payload caused the server to throw an error. Underlying error message: XDMP-JSONDOC: xdmp:get-request-body() -- Document is not JSON".

I cant see a json error, although no expert. Running on Windows 8.1. Am copying the text into Word doc then into dos prompt.

2

2 Answers

4
votes

You likely have a dozen very nice looking glyphs that look like, but are not, what you think. Start over and don't use Word or Notepad or another plain ascii text editor as your clipboard. Double check that the encoding is 7bit ascii not 8859-1, or type it in. Double check with a hex dump like od -c.

Modern publication tool favor good typography over character encoding fidelity.

3
votes

I now beleive this is an escaping issue. What is shown on the Marklogic page presumably works in Linux environment.

What worked for me on Windows was to not use single quotes. That means a double, not single, quote for the outer string wrapper, and escaping the double quotes within the string.

-d "{\"rest-api\": { \"name\": \"TutorialServer\", \"port\": \"8011\", \"database\": \"TutorialDB\", \"modules-database\": \"Tutorial-Modules\" } }" \

Many thanks to Stephen C from ML for working this out for me.