Loading TOC...

xdmp:http-put

xdmp:http-put(
   $uri as xs:string,
   [$options as (element()|map:map)?],
   [$data as node()?]
) as item()+

Summary

Sends an HTTP PUT request to an HTTP server. The HTTP server should return a response, which will differ depending on the action the HTTP server takes for the PUT.

Parameters
uri The URI to which the data is to be put.
options The options node for this request. The default value is (). The node for the xdmp:http-put options must be in the xdmp:http namespace.

The options include the following option (in the xdmp:http namespace), in addition to the options documented with the xdmp:http-get $options parameter:

<data>

This option can contain any string. Anything in the data option is sent as a string in the PUT body. If binary is to be sent, it can be specified as the optional third argument instead.

The other options are the same as the other xdmp:http-* functions, and the options are documented with the xdmp:http-get $options parameter.

data The data for this request. This is an alternative to the data option for the second parameter that allows binary content to be specified for the body of the PUT.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-http-put

Usage Notes

The http functions only operate on URIs that use the http or https schemes; specifying a URI that does not begin with http:// or https:// throws an exception.

If an http function times out, it throws a socket received exception (SVC-SOCRECV).

If you expect the request body from this http function to be processed by another application (via a web service, for example), you should specify a content-type header. If no content-type header is specified, the content type defaults to text/plain.

Example

xdmp:http-put("http://www.my.com/document.xhtml",
     <options xmlns="xdmp:http">
       <authentication method="basic">
         <username>myname</username>
         <password>mypassword</password>
       </authentication>
     </options>)
=> the response from the HTTP server as well as the specified document


Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.