Loading TOC...

MarkLogic 9 Product Documentation
POST /admin/v1/instance-admin

Summary

Install the admin username and password, and initialize the security database and objects.

URL Parameters
format The format of the data in the response body. Allowed values: json or xml. If present, this parameter overrides the Accept header.
admin-username The user name to be configured as the admin user. You can either pass this parameter as form data in the request body, or provide this data in an XML or JSON payload. For details, see the Usage Notes.
admin-password The password to be configured as the admin user. You can either pass this parameter as form data in the request body, or provide this data in an XML or JSON payload. For details, see the Usage Notes.
wallet-password The wallet password. This is required for setting up an endpoint. You can either pass this parameter as form data in the request body, or provide this data in an XML or JSON payload. For details, see the Usage Notes.
realm The authentication realm of the admin user. The realms allow protected resources on a server to be partitioned into a set of protection spaces, each with its own authentication scheme. The realms are stored in the security database and used in computing digest authentication tokens.
Request Headers
Accept The expected MIME type of the request body. If the format parameter is present, it takes precedence over the Accept header. Only application/xml and application/json are supported.
Content-type The MIME type of the data in the request body, if any. Allowed values: application/xml, application/json, or application/x-www-form-urlencoded. The format request parameter takes precedence over this header if present.
Response Headers
Content-type The MIME type of the data in the response body. Use the Accept header or format request parameter to specify a preferred format. The format parameter takes precedence over the requesAccept header if both are present.

Response

Upon success, MarkLogic Server returns status code 202 (Accepted) and the response body contains a timestamp and a link to the timestamp service. Use this information to detect when the server restart completes.

Required Privileges

If the security database has not yet been initialized, no authentication is required. If the security database has been already initialized, the request will fail with the status code 400, which is the expected behavior, because you only may initialize the security database once for a given instance of MarkLogic Server.

Usage Notes

This request must be directed to the MarkLogic Server Admin Interface on port 8001. For example: http://localhost:8001/admin/v1/instance-admin.

You must call POST /admin/v1/init or otherwise initialize MarkLogic Server prior to using this method.

Only call this method on a standalone host (not intended to be part of a cluster), or the initial bootstrap host of a cluster. Do not use this method on additional hosts in a cluster. Instead, use the cluster join sequence shown in POST /admin/v1/cluster-config.

You can supply the admin user name and password using either XML, JSON or form data. If you choose form data, you must set the Content-type header to application/x-www-form-urlencoded If you choose XML or JSON, you can specify the content type using either the format request parameter or the Content-type header. Use the following templates for the POST body; admin-username, admin-password, and wallet-password are the only required settings.


XML:
<instance-admin xmlns="http://marklogic.com/manage">
   <admin-password>your-admin-username</admin-password>
   <admin-username>your-admin-password</admin-username>
   <wallet-password>your-wallet-password</wallet-password>
   <realm>public</realm>
</instance-admin>

JSON:
{ "admin-username" : "your-admin-username",
  "admin-password" : "your-admin-password",
  "wallet-password" : "your-wallet-password",
  "realm" : "public"
}

Form Data (must be URL encoded):
admin-username=adminuser&admin-password=mypassword&wallet-password=walletpassword&realm=public
   

If successful, this method causes MarkLogic Server to restart. You can use the timestamp and the link to the timestamp service to poll the status of the restart. For details, see GET /admin/v1/timestamp.

For details and a complete example, see Setting Up the First Host in a Cluster in the Scripting Administrative Tasks Guide.

Example


$ curl -i -X POST \
    --data "admin-username=adminuser&admin-password=mypassword&wallet-password=walletpassword&realm=public" \
    http://localhost:8001/admin/v1/instance-admin

==> MarkLogic Server responds with headers and a response body similar
    to the following:

HTTP/1.1 202 Accepted
Content-type: application/xml
Location: /admin/v1/timestamp
...

<restart xmlns="http://marklogic.com/manage">
    <last-startup host-id="13544732455686476949">
      2013-04-01T10:35:19.09913-07:00
    </last-startup>
    <link>
      <kindref>timestamp</kindref>
      <uriref>/admin/v1/timestamp</uriref>
    </link>
    <message>Check for new timestamp to verify host restart.</message>
</restart>
    

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