Verify that MarkLogic Server is up and accepting requests.
Response Headers | |
---|---|
Content-type | The MIME type of the data in the response
body. Always text/plain . |
If MarkLogic Server is available, this request returns response code 200 (OK)
and the reponse body contains a plain text timestamp that can be used with the timestamp
returned by asynchronous admin
and manage
requests to confirm that a
restart ocurred and has completed.
This request must be directed to the MarkLogic Server Admin Interface on port 8001. For
example: http://localhost:8001/admin/v1/timestamp
.
Management REST API that cause a restart usually return a reference to this service in the response Location header and/or the data in the response body. You can use this reference to test whether the restart has successfully completed.
To test if MarkLogic Server is up and available on a given host, you can use eiher the GET or HEAD methods of /admin/v1/timestamp. If status code 200 (OK) is returned, MarkLogic Server is available.
To test for a restart, call GET /admin/v1/timestamp prior to the operation that can cause a restart, then call it again afterwards, and compare the two timestamps.
For details and a complete example, see Using the Timestamp Service to Verify a Restart in the Scripting Administrative Tasks Guide.
curl --anyauth --user user:password -X GET -i \ http://localhost:8001/admin/v1/timestamp ==> MarkLogic Server responds with a timestamp and headers similar to the following. The timestamp in the response body is the time of the last restart. HTTP/1.1 200 OK Server: MarkLogic Content-Type: text/plain; charset=UTF-8 Content-Length: 32 Connection: Keep-Alive Keep-Alive: timeout=5 2013-05-15T10:34:38.932514-07:00
An operation causing a restart returns a response similar to the following. Note the Location header and <uriref> to the timestamp service. Use it to construct a GET or HEAD request to this service. HTTP/1.1 202 Accepted Content-type: application/xml Location: /admin/v1/timestamp Server: MarkLogic Content-Length: 260 Connection: Keep-Alive Keep-Alive: timeout=5 <restart xmlns="http://marklogic.com/manage"> <last-startup host-id="13544732455686476949"> 2013-05-15T09:01:43.019261-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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.