Loading TOC...

MarkLogic 9 Product Documentation
GET /v1/config/resources

Summary

Retrieve a list of installed resource service extensions, including their metadata.

URL Parameters
format? The expected content type of the response, either xml or json. Overrides the Accept header.
refresh? Whether or not to refresh metadata before generating the response. Default: true.
Request Headers
Accept* The expected MIME type of the response, either application/xml, application/json, or text/xml. Ignored if the format parameter is present.
Response Headers
Content-type The MIME type of the content in the response, either application/xml or application/json.

Response

Upon success, MarkLogic Server returns status 200 (OK) and returns the requested listing in XML or JSON in the response body. The amount of detail available for a given extension depends on the metadata specified during extension installation.

Required Privileges

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

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

Usage Notes

Specify the expected response content type using either the format parameter or Accept header. If you supply both, the format parameter takes precedence. If you specify neither, XML is returned.

When refresh is true (the default), extension metadata is rebuilt from the most recent installation of all extensions. When set to false, the metadata in the response reflects the contents as of the last refresh, and may be out of synch if there has been a subsequent update to the extension. You should only need to set refresh to false if you find this request is taking too long. Extension metadata is only used for informational purposes, so the ability of client applications to use an extension is not affected by out of synch metadata.

For details, see Discovering Resource Service Extensions in the REST Application Developer's Guide.

Example

$ curl --anyauth --user user:password -H "Accept: application/xml" -X GET -i \
    http://localhost:8004/v1/config/resources

==> A list of resource service extensions is returned as XML in the response
    body. For example, the output below reflects a extension, "example",
    which supports only a GET method. The GET method accepts a single
    string parameter, "the-uri". The provider is "Acme Widgets".

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

HTTP/1.1 200 OK
Content-type: application/xml
Server: MarkLogic
Content-Length: 571
Connection: close

<rapi:resources xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:resource>
    <rapi:name>example</rapi:name>
    <rapi:title/>
    <rapi:version/>
    <rapi:provider-name>Acme Widgets</rapi:provider-name>
    <rapi:description/>
    <rapi:methods>
      <rapi:method>
        <rapi:method-name>get</rapi:method-name>
        <rapi:parameter>
          <rapi:parameter-name>the-uri</rapi:parameter-name>
          <rapi:parameter-type>string</rapi:parameter-type>
        </rapi:parameter>
      </rapi:method>
    </rapi:methods>
    <rapi:resource-source>/v1/resources/example</rapi:resource-source>
  </rapi:resource>
</rapi:resources>
  

Example

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

==> A list of resource service extensions is returned as JSON in the response
    body. For example, the output below reflects a single extension, "example",
    which supports only a GET method. The GET method accepts a single
    string parameter, "the-uri". The provider is "Acme Widgets".

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

HTTP/1.1 200 OK
Content-type: application/json
Server: MarkLogic
Content-Length: 286
Connection: close

{
  "resources": {
    "resource": [
      {
        "name": "example",
        "title": "",
        "version": "",
        "provider-name": "Acme Widgets",
        "description": "",
        "methods": {
          "method": [
            {
              "parameter": [
                {
                  "parameter-name": "the-uri",
                  "parameter-type": "string"
                }
              ],
              "method-name": "get"
            }
          ]
        },
        "resource-source": "/v1/resources/example"
      }
    ]
  }
}
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.