POST _replicate

In this document

This request starts or cancels a database replication operation.

Request


Request headers

This request does not have any required headers.

Query parameters

This request does not use query parameters.

Message body

The request message body is a JSON document that contains the following objects:

NameTypeDescriptionRequired
create_targetBooleanIndicates whether to create the target databaseNo
sourcestringURI of the source databaseYes
targetstringURI of the target databaseYes

Response


Status codes

Response headers

This response uses only standard HTTP headers.

Message body

The response message body is a JSON document that contains the following objects.

NameTypeDescription
okBooleanIndicates whether the replication operation was successful
session_idstringSession identifier

Example


The following example replicates the database named beer-db located at sync.couchbasecloud.com to a database named beer-db on the local server.

Request

POST /_replicate HTTP/1.1
Host: localhost:59840
{
   "create_target" : true,
   "source" : "http://sync.couchbasecloud.com/beer-db/",
   "target" : "beer-db",
}

Response

Status Code: 200 OK
Accept-Ranges: bytes
Date: Fri, 06 Dec 2013 21:57:08 GMT
Server: CouchbaseLite 1.485
Transfer-Encoding: chunked
{
   "session_id":"repl001",
   "ok":true
}