<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.getRequestBody.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.getRequestBody</api:function-name><api:suggest>xdmp.getrequestbody</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>getrequestbody</api:suggest><api:function-link mode="xquery" fullname="xdmp:get-request-body">/apidoc/8.0/xdmp:get-request-body.xml</api:function-link><api:function mode="javascript" name="getRequestBody" type="builtin" lib="xdmp" category="AppServerBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.getRequestBody"><api:summary>
  For PUT requests, returns the body of the request.
  For POST requests, returns the body of the request if it is not of
  content-type application/x-www-form-urlencoded.

  <p xmlns="http://www.w3.org/1999/xhtml">Returns the empty sequence if it is not called from an application
  server.</p>
</api:summary><api:params><api:param name="format" type="xs:string?" optional="true"><api:param-description>
    The format ("xml", "text", or "binary") to interpret the body as.  If not supplied,
    the format associated with the content-type header in mimetypes.xml is used.  If no
    content-type header exists, the default format is "binary".
  </api:param-description><api:param-name>format</api:param-name><api:param-type>String?</api:param-type></api:param></api:params><api:return class="javascript">Object?</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">If the content-type of the POST body is application/x-www-form-urlencoded,
  it is not available here, but instead is available in its decoded form
  through <code>xdmp:get-request-field-names()</code> and
  <code>xdmp:get-request-field()</code>.</p>

  <p xmlns="http://www.w3.org/1999/xhtml">If there is no content-type header in the request, then the request
  body defaults to application/x-www-form-urlencoded, and therefore
  <code>xdmp:get-request-body</code> will return the empty sequence. If
  you want to read the request body, then the POST must include a
  content-type header.</p>

  <p xmlns="http://www.w3.org/1999/xhtml">You can use this function to process certain types of web service
  SOAP requests with MarkLogic Server.</p>

  <p xmlns="http://www.w3.org/1999/xhtml">The output of an <code>xdmp:get-request-body</code> call is
  typically a document node, so if you want to get the contents of
  the POST, you should add a <code>/node()</code> XPath step to
  the output.  The contents of the document node could be a text node,
  an element node, or a binary node.</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.getRequestBody();
=&gt; "Contents of POST body."
</pre></api:example></api:function></api:function-page>