MarkLogic Server 11.0 Product Documentation
GET /v1/values

Summary

Retrieve a list of lexicon configurations available for use with GET /v1/values/{name}.

URL Parameters
database? Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.
format? Specifies the MIME type of the response content, as an alternative to specifying format via the Accept header. Accepted values: json and xml (default). If there is no format parameter, the format must be specified in the Accept header.
options? The query options for which to list available lexicon configurations.
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 200 status, with an XML or JSON listing of available named lexicon configurations in the response body.

MarkLogic Server returns a 400 (Bad Request) if no query options match the value of the options parameter.

Required Privileges

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

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

Usage Notes

Query options named in the options request parameter must be pre-installed using the /config/query service. If no options parameter is given, this method lists available <values> and <tuples> from the configured default options. If there are no default options, the global Search API options are used. Use the /config/query/{name} service to create named query options.

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 details, see Controlling Input and Output Content Type in the REST Application Developer's Guide.

For more information on defining queryable lexicons and indexes, see Identifying Lexicon and Range Index Values in Query Options in the REST Application Developer's Guide.

Example

Given the following query options are installed under the name "values":

<options xmlns="http://marklogic.com/appservices/search">
  <values name="speaker">
    <range type="xs:string">
      <element ns="" name="SPEAKER"/>
    </range>
  </values>
  <tuples name="speaker-title">
    <range type="xs:string">
      <element ns="" name="SPEAKER"/>
    </range>
    <range type="xs:string">
      <path-index>/PLAY/ACT/SCENE/TITLE</path-index>
    </range>
  </tuples>
</options>

$ curl --anyauth --user user:password -X GET -H "Accept: application/xml" \
    'http://localhost:8004/v1/values?options=ex-values'

==> An XML report of the lexicon queries available through /values/{name}:

<rapi:values-list xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:values>
    <rapi:name>speaker</rapi:name>
    <rapi:uri>/v1/values/speaker?options=values</rapi:uri>
  </rapi:values>
  <rapi:values>
    <rapi:name>speaker-title</rapi:name>
    <rapi:uri>/v1/values/speaker-title?options=values</rapi:uri>
  </rapi:values>
</rapi:values-list>
  

Example

Given the following query options installed under the name "ex-values":

{ "options": {
    "values": [
      {
        "name": "speaker",
        "range": {
          "type": "xs:string",
          "element": {
            "ns": "",
            "name": "SPEAKER"
          }
        }
      }
    ],
    "tuples": [ {
        "name": "speaker-title",
        "range": [
          {
            "type": "xs:string",
            "element": {
              "ns": "",
              "name": "SPEAKER"
            }
          },
          {
            "type": "xs:string",
            "path-index": { "text": "/PLAY/ACT/SCENE/TITLE" }
          }
        ]
    } ]
} }

$ curl --anyauth --user user:password -X GET -H "Accept: application/json" \
    'http://localhost:8004/v1/values?options=ex-values'

==> A JSON report of the lexicon queries available through /values/{name}:
{
  "values-list": {
    "values": [
      {
        "name": "speaker",
        "uri": "/v1/values/speaker?options=values"
      },
      {
        "name": "speaker-title",
        "uri": "/v1/values/speaker-title?options=values"
      }
    ]
  }
}
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy