MarkLogic Data Hub Service

Fast data integration + improved data governance and security, with no infrastructure to buy or manage.

Learn More


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up


MarkLogic World 2019

Learn how to simplify data integration & build innovative applications. Join us in Washington D.C. May 14-15!

Find Out More


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up

Learning the MarkLogic REST API

Evan Lenz and Dave Cassel
Last updated October 21, 2016

MarkLogic is an enterprise-class NoSQL database built on search engine technology. This tutorial will walk you through a series of HOWTOs for working with MarkLogic exclusively through its REST API.

If you'd prefer to work with MarkLogic using Java, start instead with MarkLogic for Java developers.


MarkLogic's REST API allows you to create, read, update, and delete documents (CRUD), as well as search documents and perform analytics on the values they contain. The REST API gives you the building blocks you need for a faceted search application's data layer, using your language of choice (e.g., Ruby, Python, PHP, etc.). For purposes of this tutorial, you'll be using the cURL command-line utility to interactively learn the REST API.

MarkLogic basics

The basic unit of organization in MarkLogic is the document. Documents can occur in one of four formats:

  • XML
  • JSON
  • text
  • binary

Each document is identified by a URI, such as "/example/foo.json", which is unique within the database.

As with files on a filesystem, documents can be grouped into directories. This is done implicitly via the URI. For example, the document with the URI "/docs/plays/hamlet.xml" resides in the "/docs/plays/" directory.

Documents can also be grouped (independently of their URI) into collections. A collection is essentially a tag (string) associated with the document. A document can have any number of collection tags associated with it. Collections represent one kind of metadata that can be associated with documents. We'll see how to manipulate both document content and metadata.


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


The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • Hi, I am new to MarkLogic, which API would you recommend using REST or JAVA? They seem to have similar functionality?
  • I am looking for some python code to use the ML REST API anyone? hugo
    • Hey there, I know a python user who's done some work here. I'll check in with him.
  • Is it there in version 5 also.
    • The REST API is new in MarkLogic 6.  If you need a REST API for MarkLogic before version 6, please see - there is a brief tutorial at ; the Corona wiki is also helpful :