Loading TOC...

MarkLogic Server 11.0 Product Documentation
GET /v1/rest-apis

Summary

Retrieve a list of REST API instances, including configuration details. This request is only available on port 8002.

URL Parameters
database? Limit the results to services connected to the named database.
format? Specifies the type of the response content, as an alternative to specifying format via the Accept header. Accepted values: json and xml. If there is no format parameter, the format must be specified in the Accept header.
group? The name of a Group in a MarkLogic Server cluster. If no group is specified, information is returned for all groups.
Request Headers
Accept Specifies the MIME type of the response content. The only supported types are application/json and application/xml (default). The type can also be specified through the format parameter.

Response

Upon success, MarkLogic Server returns status 200 OK and configuration details on all REST API instances, in XML or JSON.

Required Privileges

This operation requires the rest-admin role, or the following privileges:

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

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

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

Usage Notes

If no instances are configured, MarkLogic Server returns an empty <rest-apis> node.

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 Retrieving Configuration Information in the REST Application Developer's Guide.

Example

curl --anyauth --user user:password -X GET -i -H "Accept: application/xml" \
  http://localhost:8002/v1/rest-apis

==> Information about configured REST services, in XML:

Content-type: text/html; charset=UTF-8
Server: MarkLogic
Content-Length: 1992
Connection: close

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

<rapi:rest-apis xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:rest-api>
    <rapi:name>my-service</rapi:name>
    <rapi:group>Default</rapi:group>
    <rapi:database>my-database</rapi:database>
    <rapi:modules>my-service-modules</rapi:database>
    <rapi:port>8003</rapi:port>
  </rapi:rest-rapi:api>
</rapi:rest-apis>
  

Example

curl --anyauth --user user:password -i -X GET -H "Accept: application/json" \
  http://localhost:8002/v1/rest-apis

==> Information about configured REST services, in JSON:

HTTP/1.1 200 OK
vnd.marklogic.document-format: json
Content-type: application/json; charset=UTF-8
Server: MarkLogic
Connection: close

{
  "rest-apis": [
    {
      "name": "my-service",
      "group": "Default",
      "database": "my-database",
      "modules": "my-service-modules",
      "port": "8003"
    }
  ]
}
  

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