Getting revisions

I’ve trying to get revisions of documents from the sync-gateway. These docs say to use revs=true and revs_info=true parameters. The revs_info parameter doesn’t seem to work, and is also not documented (its used in the example but not described in the doc). The response I get back has a list of ids:

  "_revisions": {
    "ids": [

But no _revs_info. As far as I can tell these ids aren’t any use because they are missing a numeric prefix. The example shows a more useful _revs_info block:

Is it possible to get this information?


The revs_info parameter is not supported, you are correct, that is a docs issue.

You might be able to use open_revs=all to get the data you want, by default this returns multipart, but you can get a plain JSON response by passing a Accept header e.g.

curl -X GET "http://localhost:4985/db/doc5?open_revs=all" -H "Accept: application/json"


[ {"ok":{"_id":"doc5","_rev":"2-60920e5a08459d2ce5bf8973a962cd81","owners":"user1","type":"bar"}} ]

If you look closely, the _revisions object also has a start property whose value is the starting numeric prefix of the rev IDs. Our docs don’t describe this, but the CouchDB docs do.

IIRC, _revs_info support has been added for 1.3 and should be in the latest nightly builds.

Thanks for the reply, but the open_revs solutions doesn’t give m all the open revisions. I’ll try another approach

Hey @nick-couchbase - Andy is correct - open_revs=all should give you all the open (i.e. non-deleted leaf) revisions as multipart entries. If that’s not working for you, I’d be interested in hearing the details.

Here’s a sample response from my local DB:

GET /default/revdoc?open_revs=all HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Host: localhost:4985
User-Agent: HTTPie/0.8.0

HTTP/1.1 200 OK
Content-Encoding: gzip
Content-Length: 187
Content-Type: multipart/mixed; boundary="49bfe5b56797cf03661dba923c2c707ae3220c606e9c7a8a3a4d125c9b4a"
Date: Tue, 12 Jul 2016 16:19:54 GMT
Server: Couchbase Sync Gateway/1.3 branch/feature/internal_provider_fix commit/d0aab96+CHANGES

Content-Type: application/json

Content-Type: application/json


I upgraded the SG to 1.3 and open_revs and revs_info are working.

A correction on my earlier post - open_revs=all will give you all leaf revisions, including tombstones.