Search code examples
xquerymarklogic

How do I get the HTTP POST body in MarkLogic XQuery?


I'm trying to use the exist-db request:get-data() method to get the post data of a request. However, I'm getting the error:

XDMP-UNDFUN: (err:XPST0017) Undefined function request:get-data()

I did declare the namespace in my header. I don't understand why I still can't use request:get-data() or any of the other request: functions

declare namespace request="http://exist-db.org/xquery/request";
declare option exist:serialize "method=xml media-type=text/xml indent=yes";

let $post-data := request:get-data()
return $post-data

Solution

  • I think you're looking for xdmp:get-request-body.