Search code examples
marklogicmarklogic-9

Marklogic 9.0-3 REST Parameters accessing in REST extensions


I have a REST extension and I have beeing accessing the parameters that have been passed, both in GET and POST as follows.. The parameters are passed as form-data or x-www-form-urlencoded. In my REST extension I would access the parameters via xdmp:get-request-field("remoteURL").

In ML-8, this worked where in when calling the WS I would pass in the parameters as remoteURL and it worked..

Now in ML-9.0-3, it does not work, so I tried passing the parameters via rs:remoteURL and access in the REST extension as xdmp:get-request-field("remoteURL") and it fails, but when I access as xdmp:get-request-field("rs:remoteURL"). it works.. Did this got changed in ML-9.0-3 ?

Just for complete I am including my REST extension code as well

declare function repoTest:post($context as map:map, $params  as map:map,$input   as document-node()*) as document-node()*
{
  let $_ := xdmp:log("Inside the Repo Test POST")
  let $remoteURL :=xdmp:get-request-field("remoteURL")
  let $_ := xdmp:log($remoteURL)
  let $output := json:object()
  let $_ :=  map:put($output, "remoteURL", $remoteURL)
  return document { xdmp:to-json($output) }
};

Solution

  • I am not aware of a change in this, though it could be very well possible. I'd recommend accessing parameters via the $params map:map, which is the recommended way for REST extensions anyhow. $params will always contains any rs: request parameters without the rs: prefix.

    HTH!