{ "ns" : "http://expath.org/ns/http-client", "description" : "

\n This module provides an implementation of the\n EXPath Http Client.\n It provides functions for making HTTP requests and is a superset of the\n module specified by EXPath.\n Specifically, it implements the http:send-request() functions\n as specified by EXPath. Moreover, it adds an additional function\n http:read() (with several arities for the sake of ease).\n

\n

\n In general, both functions take a description of the HTTP request to make\n as parameter, execute the request, and return a representation of the HTTP\n response. For instance, in the following code snippet, we fetch the Zorba\n home page:\n

\n
import module namespace http = \"http://expath.org/ns/http-client\";\n http:send-request(\n  <http:request href=\"http://zorba.io\" method=\"get\" />\n )\n 
\n

\n The http:send-request() functions are declared as sequential.\n Sequential functions are allowed to have side effects. For example, most probably,\n an HTTP POST request is a request that has side effects because it adds/changes\n a remote resource. Sequential functions are specified in the\n XQuery Scripting Extension.\n In contrast, the http:read() functions are not declared as sequential -\n they are declared as nondeterministic though, which\n means that several calls may return different results.\n HTTP requests performed using these functions are not allowed to have\n side effects.\n

\n

\n The response is returned as a sequence of one or more items. The first\n one is an http:response element with quite the same\n structure as an http:request, but without the content itself.\n The content is returned as the second item (or several items in case of\n a multipart response) as a string, a document node, or a binary item.\n This depends on the content-type returned.\n Specifically, the rules are as follows:\n

\n

\n

\n The structure of a request element is defined in the schema that is imported\n by this module. The details are described in the\n specification.\n Analogously, the response element is also described in this\n specification.\n

\n", "sees" : [ "XQuery 3.0: Function Declaration" ], "authors" : [ "Federico Cavalieri, Markus Pilman" ], "version" : null, "encoding" : "utf-8", "namespaces" : [ { "uri" : "http://zorba.io/annotations", "prefix" : "an" }, { "uri" : "http://expath.org/ns/error", "prefix" : "err" }, { "uri" : "http://expath.org/ns/http-client", "prefix" : "http" }, { "uri" : "http://zorba.io/modules/http-client-wrapper", "prefix" : "http-wrapper" }, { "uri" : "http://expath.org/ns/http-client", "prefix" : "https" }, { "uri" : "http://www.zorba-xquery.com/modules/converters/html", "prefix" : "tidy" }, { "uri" : "http://www.zorba-xquery.com/modules/converters/html-options", "prefix" : "tidy-options" }, { "uri" : "http://zorba.io/options/versioning", "prefix" : "ver" } ], "functions" : [ { "arity" : 1, "name" : "send-request", "qname" : "http:send-request", "signature" : "($request as element(*)) as item()+", "description" : " Function for convenience.\n Calling this function is equivalent to calling\n \n http:send-request($request, (), ())\n \n", "summary" : "

Function for convenience.

", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "request", "type" : "element(*)", "occurence" : null, "description" : "
see request parameter of the sequential send-request function with three parameters.
" } ], "returns" : { "type" : "item()+", "description" : "see return value of the sequential send-request function with three parameters." }, "errors" : [ ] }, { "arity" : 2, "name" : "send-request", "qname" : "http:send-request", "signature" : "($request as element(*)?, $href as xs:string?) as item()+", "description" : " Function for convenience.\n Calling this function is equivalent to calling\n \n http:send-request($request, $href, ())\n \n", "summary" : "

Function for convenience.

", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "request", "type" : "element(*)", "occurence" : null, "description" : "
see request parameter of the sequential send-request function with three parameters.
" }, { "name" : "href", "type" : "xs:string", "occurence" : null, "description" : "
see href parameter of the sequential send-request function with three parameters.
" } ], "returns" : { "type" : "item()+", "description" : "see return of send-request" }, "errors" : [ ] }, { "arity" : 3, "name" : "send-request", "qname" : "http:send-request", "signature" : "($request as element(*)?, $href as xs:string?, $bodies as item()*) as item()+", "description" : " This function sends an HTTP request and returns the corresponding response.\n

\n This function is declared as sequential (see XQuery Scripting).\n Sequential functions are allowed to have side effects. For example, most probably,\n an HTTP POST request is a request that has side effects because it adds/changes\n a remote resource.\n

\n", "summary" : "

This function sends an HTTP request and returns the corresponding response.

", "annotation_str" : " %an:sequential", "annotations" : [ { "prefix" : "an", "ns" : "http://zorba.io/annotations", "name" : "sequential", "value" : "" } ], "updating" : false, "parameters" : [ { "name" : "request", "type" : "element(*)", "occurence" : null, "description" : "
Contains the various parameters of the request. See the specification. for a full description of the structure of this element.
" }, { "name" : "href", "type" : "xs:string", "occurence" : null, "description" : "
is the HTTP or HTTPS URI to send the request to. It must be a valid xs:anyURI, but is declared as a string to be able to pass literal strings (without requiring to explicitly cast it to an xs:anyURI.)
" }, { "name" : "bodies", "type" : "item()", "occurence" : null, "description" : "" } ], "returns" : { "type" : "item()+", "description" : "a sequence of items, where the first item is a element of type http:responseType. The response element is also described in the specification. If there is one (or several, in case of multipart) response body, the response bodies are the next items in the sequence." }, "errors" : [ ] } ], "variables" : [ ] }