Obtain the options node for a resource address
As described in Creating an Interpretive XQuery Rewriter to Support REST Web Services in Developing Server-Side Applications, the REST Library uses an options
node to map incoming requests to endpoints. The options
node contains information about the communication options available on the request/response chain for the resource address, such as which parameters can be specified with the resource address.
You can use the xdmp:http-options
function to output the options
node for any resource address. For example, you can enter the following query in Query Console to display the options
node for the /manage/LATEST/transactions
resource address:
xdmp:http-options( "http://localhost:8002/manage/LATEST/transactions", <options xmlns="xdmp:http"> <authentication method="digest"> <username>admin</username> <password>admin</password> </authentication> </options>)
The output will include a request
element that defines the options associated with the GET and HEAD methods for the resource address. From this, you can determine the supported parameters and values. For example, the above resource address supports the view,
seconds-min
, host-id
, fullrefs
, and format
parameters, as shown below.
<rest:http method="GET"> <rest:param name="view" values="default" default="default"/> <rest:param name="seconds-min" as="string"/> <rest:param name="host-id" as="string"/> <rest:param name="fullrefs" as="boolean" required="false"/> <rest:param name="format" as="string" values="xml|json|html"/> <rest:or> <rest:accept>application/xml</rest:accept> <rest:accept>application/json</rest:accept> <rest:accept>text/html</rest:accept> <rest:accept>application/x-javascript</rest:accept> </rest:or> </rest:http>