title: How to post XQuery code to MarkLogic using cURL from Ubuntu?
body: <p>I am using Ubuntu machine.
  I am doing POST call using curl command and sending <strong>xquery code</strong> as --data in string format.
  In response I am getting below error:</p>
  
  <pre><code>xdmp:database()HTTP/1.1 500 REST-UNSUPPORTEDPARAM: (rest:UNSUPPORTEDPARAM) Endpoint does not support query parameter: xdmp:database()
  </code></pre>
  
  <p>Below is the complete <strong>curl command</strong></p>
  
  <pre><code>curl -v --digest -u username --request POST "http://host:port/qconsole/endpoints/evaler.xqy?dbid=someid&amp;querytype=xquery&amp;action=eval" --data "xdmp:database()"
  </code></pre>
  
  <p>In the above command Basically I am trying to run xquery code on the targeted machine (host:port/endpoints/evaler.xqy)</p>
  
  <p>Is this the right way to pass xquery code?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I am using <strong>ML 7</strong></p>
  
  <p>After passing the headers I am able to run the XQuery code but facing one more issue.</p>
  
  <p>When I am passing "xdmp:database()" as data It's working fine (see the below command), in the response I am getting database ID.</p>
  
  <pre><code> curl -v --digest -uusername --data "xdmp:database()" --header "Content-type:text/x-www-form-urlencoded" --header "Accept: multipart/mixed; boundary=BOUNDARY" --request POST "http://host:port/qconsole/endpoints/evaler.xqy?dbid=dbid&amp;querytype=xquery&amp;action=eval"
  </code></pre>
  
  <p>When I tried with passing "let $x := 10 return $x" as data (As given in below command) I am getting</p>
  
  <p><strong>x: undefined variable</strong> </p>
  
  <p>even not asking for password!!</p>
  
  <pre><code> curl -v --digest -u username --data "let $x := 10 return $x" --header "Content-type:text/x-www-form-urlencoded" --header "Accept: multipart/mixed; boundary=BOUNDARY" --request POST "http://host:port/qconsole/endpoints/evaler.xqy?dbid=dbid&amp;querytype=xquery&amp;action=eval"
  </code></pre>
  
  <p>Not able to figure it out, What I am doing wrong.</p>
  
  <p>Please help.</p>