Loading TOC...

rest functions

The table below lists all the rest built-in functions (in this namespace: http://marklogic.com/appservices/rest).

The REST library enables you to create RESTful functions that are independent of the language used in applications.

The REST library consists of a set of XQuery functions that support URL rewriting and endpoint validation and a MarkLogic REST vocabulary that simplifies the task of describing web service endpoints. The REST vocabulary is used to write declarative descriptions of the endpoints. These descriptions include the mapping of URL parts to parameters and conditions that must be met in order for the incoming request to be mapped to an endpoint.

The REST library is installed as the following file:


where install_dir is the directory in which MarkLogic Server is installed.

To use the rest.xqy module in your own XQuery modules, include the following line in your XQuery prolog:

  import module namespace rest = "http://marklogic.com/appservices/rest"  
      at "/MarkLogic/appservices/utils/rest.xqy";

The library uses the rest: namespace, which is not predefined in the server.

7 functions
Function name Description
rest:check-options This function validates the specified options node.
rest:check-request This function takes a request element and returns a report of the problems found.
rest:get-raw-query-params This function extracts all of the query parameters and returns them in a map.
rest:matching-request This function returns the request element in the options node that matches the specified URI.
rest:process-request This function is used in the endpoint main module to parse the incoming request against the options.
rest:report-error This function formats the specified error structure.
rest:rewrite This function is used in the URL rewriter to map the incoming request to an endpoint.