POST _replicate
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:
| Name | Type | Description | Required |
|---|---|---|---|
create_target | Boolean | Indicates whether to create the target database | No |
source | string | URI of the source database | Yes |
target | string | URI of the target database | Yes |
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.
| Name | Type | Description |
|---|---|---|
ok | Boolean | Indicates whether the replication operation was successful |
session_id | string | Session 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
}