On May 14, 2014, at 9:24 AM, Michael Mayer <
mi...@themayerhouse.com> wrote:
> I am trying to understand how to insert and update documents via the Sync-Gateway REST API. The insert seems pretty straight forward using the PUT /db/docid method but I'm not understanding the update scenario.
Update is just another PUT, but you have to include the document’s current revision ID as the body’s “_rev” property. (This is to prevent multiple writers from clobbering each others’ writes.) The revision ID is returned from the PUT call, and also appears as “_rev” in a GET.
> I have tried POST'ing to /db/_bulk_docs but I clearly do not understand the body structure the API is expecting as I receive an error that "interface is nil" in the sync gateway.
It’s expecting a MIME multipart body. You probably don’t need to use _bulk_docs, as it’s just an optimization vs issuing multiple PUT requests.
—Jens