Loading TOC...

GET /v1/config/namespaces

Summary

List all namespace bindings configured for use in queries, ordered alphabetically by prefix.

URL Parameters
format? The format of the content returned by by the request, either xml or json. The format parameter overrides any format specified in the Accept header.
Request Headers
Accept* The expected MIME type of the response, either application/json or application/XML (the default). If the format parameter is set, the Accept header is ignored in favor of the format parameter.
Response Headers
Content-Type The MIME type of the content returned in the response body, one of application/xml or application/json, depending on the type requested by the format value or Accept header.

Response

Upon success, MarkLogic Server returns status 200 (OK) and the response body contains the requested information.

When requesting XML results, the response body contains data of the following form:

  <namespace-bindings xmlns="http://marklogic.com/rest-api">
    <namespace xmlns="http://marklogic.com/sdmp/group">
      <prefix>the-prefix</prefix>
      <uri>the-uri</uri>
    </namespace>
  </namespace-bindings>
    

When requesting JSON results, the response body contains data of the following form:

  {"namespace-bindings": [
    {"prefix" : "the-prefix", "uri" : "the-uri" },
    ...
  ]}
    

Required Privileges

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

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

Usage Notes

For details, see Using Namespace Bindings in the REST Application Developer's Guide.

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.

Example

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

==> MarkLogic server responds with a 200 status and the requested
    namespace binding information as XML. For example, the following
    data is returned for a single binding of the prefix "bill" to
    http://makrlogic.com/examples/shakespeare:

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

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

<rapi:namespace-bindings xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:namespace>
    <rapi:prefix>bill</rapi:prefix>
    <rapi:uri>http://marklogic.com/examples/shakespeare</rapi:uri>
  </rapi:namespace>
</rapi:namespace-bindings>
  

Example

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

==> MarkLogic server responds with a 200 status and the requested
    namespace binding information as JSON. For example, the following
    data is returned for a single binding of the prefix "bill" to
    http://makrlogic.com/examples/shakespeare:

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

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

{"namespace-bindings":[
  {
    "prefix":"bill",
    "uri":"http://marklogic.com/examples/shakespeare"
  }
]}
  

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy