Skip to content

REST API

Jens Alfke edited this page May 8, 2017 · 13 revisions

The LiteCoreREST library adds a small embedded HTTP server to LiteCore, which implements a subset of the Couchbase Lite 1.x (and CouchDB and Cloudant and PouchDB) REST API.

At this point (April 2017) it's intended mostly as an aid for automated testing of LiteCore; but it can be extended to the full API, which would allow it to support PhoneGap apps and even serve as a passive endpoint for the 1.x replication protocol.

(If you want to cross-reference with the actual code, look at where the handlers are registered in Listener.cc.)

API

Method Path Parameter Description
GET / Server info, like the version
GET /_all_dbs List of all database names
POST /_replicate Start a replication; parameters in JSON body. [See note below]
GET /_active_tasks Info on active replications
GET /db Database doc count, current sequence, etc.
DELETE /db Deletes a database
PUT /db Creates a database
POST /db Creates a document with an automatically generated UUID
GET /db/_all_docs List of documents including current revID
?include_docs=true Adds body of each doc
GET /db/id Returns document body
?rev=revID Revision ID to get (optional)
DELETE /db/id Deletes a document
?rev=revID Current revision ID (required)
PUT /db/id Creates or updates a document
?rev=revID Current revision ID (required if doc exists, unless you add a _rev property to the JSON body)

/_replicate

  • The only properties implemented so far are source, target and continuous.
  • Local-to-local replication (both source and target are local db names) isn't supported yet.
Clone this wiki locally