The Node.js Client API implementation communicates with MarkLogic Server using the remainder Client API described in REST Application Developer’s Guide.

Therefore, requests to MarkLogic Server through the Node.js Client API require the presence of a REST API instance. A REST API instance consists of an HTTP App Server specially configured to handle REST Client API requests, a default content database, and a modules database.

Each REST API instance can host a single application. If you have multiple REST
API applications, you must create an instance for each one, and each one must
have its own modules database.

When you install MarkLogic Server, a pre-configured REST API instance is out there on port 8000. This instance is out there as soon as you put in MarkLogic Server.

No further setup is required. This instance uses the Documents database because the default content database and therefore the Modules database as the modules database.

The instance on port 8000 is convenient for getting started, but you will usually create a dedicated instance for production purposes. This chapter covers creating and managing your own instance.

When you use to make a DatabaseClient object, you’re creating a connection to a REST API instance. When you create the DatabaseClient, you can specify a content database aside from the default content database related to the instance.

Using an alternative database requires extra security privileges. For details, see “Evaluating Requests Against a Different Database.

The default content database related to a REST API instance are often created for you when the instance is made , otherwise you can create it separately before making the instance. You can associate any content database with an instance.

Administer your content database as usual, using the Admin Interface, XQuery or JavaScript Admin API, or REST Management API.

The REST instance modules database are often created for you during instance creation, otherwise you can create it separately before making the instance. If you choose to pre-create the modules database, it must not be shared across instances.

Special code is inserted into the modules database during instance creation. The modules database also holds any persistent query options, extensions, content transformations, custom parsers, and other assets installed using the DatabaseClient.config interfaces.

Aside from the instance properties described during this chapter, you can’t pre-configure the App Server associated with an instance.

However, once the instance is made , you’ll further customize properties like request timeouts using the Admin Interface, XQuery or JavaScript Admin API, or REST Management API.

How to Creating an Instance

When you install MarkLogic Server, a pre-configured REST API instance is available on port However, you can create your own instance using the REST Client API.

To create a new REST instance, send a POST request to the /rest-apis service on port 8002 with a URL of the form:


You can use either the keyword LATEST or the present version for version. The POST body should contain a JSON or XML instance configuration.

The configuration must include at least a name, but also can include a port number, content and modules database name, and other instance properties.

For example, the following command uses the cURL command line tool to create an instance named “RESTstop” using the defaults for port, databases, and properties.

curl --anyauth --user user:password -X POST -i 
-d '{"rest-api": {"name":"RESTstop" }}'
-H "Content-type: application/json"

For details and examples, see Creating an Instance within the REST Application Developer’s Guide.

If you like this post, don’t forget to share 🙂

This article is written by our awesome writer
Comments to: What Is a REST API Instance In Node.js

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

New Dark Mode Is Here

Sign In to access the new Dark Mode reading option.

Join our Newsletter

Get our monthly recap with the latest news, articles and resources.

By subscribing you agree to our Privacy Policy.

Latest Articles

Explore Tutorials By Categories


Codeverb is simply an all in one interactive learning portal, we regularly add new topics and keep improving the existing ones, if you have any suggestions, questions, bugs issue or any other queries you can simply reach us via the contact page


Welcome to Codeverb

Ready to learn something new?
Join Codeverb!

Read Smart, Save Time
    Strength indicator
    Log In | Lost Password