Loading TOC...

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 only pass this parameter as form data in the request body, but you can also supply 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 only pass this parameter as form data in the request body, but you can also supply this data in an XML or JSON payload. For details, see the Usage notes.
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 security has not yet been installed, no authentication is required. If security has been installed, the request returns a status code 400.

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.

You should 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 and admin-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>
   <realm>public</realm>
</instance-admin>

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

Form Data (must be URL encoded):
admin-user=your-admin-username&admin-password=your-admin-password
   

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" \
    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.