MarkLogic 10 Product Documentation
GET /v1/config/query

Summary

Retrieve a list of all the named query options available for use with the service. For example, the names of query options previously stored using POST requests to the /config/query service. The results include the name and URI of all named query options.

URL Parameters
format? Specifies the content type of the response, as an alternative to using the Accept header. Accepted values: json and xml (default). This value takes precedence over the Accept headers. For details, see Controlling Input and Output Content Type in the REST Application Developer's Guide.
Request Headers
Accept* The expected MIME type of the information in the response. Accepted types: application/json or application/xml. Ignored if the request includes a format parameter value.
Response Headers
Content-Type The MIME type of the data in the response, either application/json or application/xml, depending upon the MIME type requested through the format parameter or Accept header on the request.

Response

Upon success, MarkLogic Server returns a status 200 (OK) and the response body contains the options data. If no query options are installed, MarkLogic Server returns an empty <query-options> node (XML) or an empty array (JSON).

Required Privileges

This operation requires the rest-reader role, or the following privilege:

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

The expected response type can be specified using either the format parameter or Accept header. One or the other must be supplied. If both are supplied and are different, the format parameter takes precedence.

For more details, see Configuring Query Options in the REST Application Developer's Guide.

Example

$ curl --anyauth --user user:password -X GET -i \
  http://localhost:8000/v1/config/query

==> A list of the names of installed options, as XML. Assuming two named
    query options, "scene" and "title" were previously installed:

Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close

HTTP/1.1 200 OK
Content-type: text/xml; charset=UTF-8
Server: MarkLogic
Content-Length: 318
Connection: close

<rapi:query-options xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:options>
    <rapi:name>default</rapi:name>
    <rapi:uri>/v1/config/query/default</rapi:uri>
  </rapi:options>
  <rapi:options>
    <rapi:name>title</rapi:name>
    <rapi:uri>/v1/config/query/title</rapi:uri>
  </rapi:options>
  <rapi:options>
    <rapi:name>scene</rapi:name>
    <rapi:uri>/v1/config/query/scene</rapi:uri>
  </rapi:options>
</rapi:query-options>
  

Example

$ curl --anyauth --user user:password -X GET -i \
  -H "Accept: application/json" 'http://localhost:8000/v1/config/query'

==> A list of the names of installed options, as JSON. Assuming two named
    query options, "scene" and "title" were previously installed:

Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 31
Connection: close

HTTP/1.1 200 OK
Content-type: text/plain; charset=UTF-8
Server: MarkLogic
Content-Length: 318
Connection: close

[
  {
    "name": "default",
    "uri": "/v1/config/query/default"
  },
  {
    "name": "title",
    "uri": "/v1/config/query/title"
  },
  {
    "name": "scene",
    "uri": "/v1/config/query/scene"
  }
]
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy