Administering your server using ReST
08 February 2021 01:28 PM
MarkLogic has shipped with a REST API since MarkLogic 7.
In MarkLogic 8 the REST API was vastly expanded, allowing ways for MarkLogic Database administrators to manage almost all common MarkLogic administration tasks over an HTTP connection to MarkLogic's REST endpoints.
This Knowledgebase article will cover some examples of common administration tasks and will show some working examples to give you a taste of what can be done if you're using the latest version of MarkLogic Server.
While there are a significant number of examples throughout our extensive documentation in this area, many of these make use of CURL. In this Knowledgebase article, we're going to use XQuery calls to demonstrate how the payloads are structured.
Creating a backup using a call to the REST API (XQuery)
In the example code below, we demonstrate a call that will perform a backup of the Documents forest which places the backup in the /tmp directory.
Running the query in the above code example will return a response (in JSON format) containing a job ID for the requested task:
The next example will demonstrate a status check for a given job ID
Query the status of an active or recent job
The above query will return a response that would look like this:
Further reading on the MarkLogic REST API: