Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for 
change notification.

The "HttpPostRevsDiff" page has been changed by JensAlfke:
http://wiki.apache.org/couchdb/HttpPostRevsDiff

New page:
<<Include(EditTheWiki)>>

= HTTP POST _revs_diff =

||'''Method'''||<-2>POST||
||'''Path'''||<-2>/_revs_diff||
||'''Query args'''||<-2>None||
||'''Request body'''||<-2>JSON object whose keys are document IDs and values 
arrays of revision IDs||
||'''Response body'''||<-2>JSON object describing which revisions are not in 
the database||

== Description ==

Given a set of document/revision IDs, returns the subset of those that do 
''not'' correspond to revisions stored in the database.

Its primary use is by the replicator, as an important optimization: after 
receiving a set of new revision IDs from the source database, the replicator 
sends this set to the destination database's _revs_diff to find out which of 
them already exist there. It can then avoid fetching and sending already-known 
document bodies.

Both the request and response bodies are JSON objects whose keys are document 
IDs; but the values are structured differently:

 * In the ''request'', a value is an array of revision IDs for that document.
 * In the ''response'', a value is an object with a {{{"missing":}}} key, whose 
value is a list of revision IDs for that document (the ones that are not stored 
in the database.)

'''Disclaimer:''' This information was derived from mailing-list posts and 
experimentation and has not yet been reviewed by someone familiar with the 
implementation. --JensAlfke, Dec. 2011

== Example ==
{{{
POST /_revs_diff HTTP/1.1
Content-Type: application/json

{"03ee06461a12f3c288bb865b22000170": ["1-b2e54331db828310f3c772d6e042ac9c", 
"2-3a24009a9525bde9e4bfa8a99046b00d"],
 "82e04f650661c9bdb88c57e044000a4b": ["3-bb39f8c740c6ffb8614c7031b46ac162"]}
}}}{{{
HTTP/1.1 200 OK
Cache-Control: must-revalidate

{"03ee06461a12f3c288bb865b22000170": {"missing": 
["2-3a24009a9525bde9e4bfa8a99046b00d"]}}
}}}

Reply via email to