couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Young (Commented) (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-642) Support rev in PUT URL
Date Thu, 06 Oct 2011 20:45:29 GMT


Benjamin Young commented on COUCHDB-642:

>From a REST perspective nothing in the query string or header should take precedence over
the content body. Meaning, the "rev" query parameter value really shouldn't override the "_rev"
keys value in the document. Updating the _rev in the JSON object seems like a very small "cost"
in exchange for the cumbersome "order of preference" given to various query parameters or
headers. The content body is the canonical source for the document--especially in regards
to a PUT.

The DELETE case doesn't require a content body, so issuing it with a "rev" is mandatory as
it semantically specifies the resource your deleting. You can delete documents via POST, but
in that case the _rev is included in the content body (as it should be)--which matches the
PUT use case.

-1 as it's just not worth the "confusion cost" for a nice-to-have.
> Support rev in PUT URL
> ----------------------
>                 Key: COUCHDB-642
>                 URL:
>             Project: CouchDB
>          Issue Type: New Feature
>          Components: HTTP Interface
>         Environment: trunk 08 Feb 2010
>            Reporter: Brian Candler
>            Priority: Minor
>         Attachments: 0001-Allow-for-the-current-revision-number-to-be.patch
> A DELETE request lets you append ?rev=xxxx to the URL. But this doesn't work with a PUT
request; you have to put the _rev in the body instead (even though the _id is taken from the
URL path)
> $ curl -X PUT -d "{}" http://brianadmin:brianadmin@
> {"ok":true,"id":"foo","rev":"1-967a00dff5e02add41819138abb3284d"}
> $ curl -X PUT -d "{}" http://brianadmin:brianadmin@
> {"error":"conflict","reason":"Document update conflict."}
> $ curl -X PUT -d '{"_rev":"1-967a00dff5e02add41819138abb3284d"}' http://brianadmin:brianadmin@
> {"ok":true,"id":"foo","rev":"2-7051cbe5c8faecd085a3fa619e6e6337"}
> Allowing ?rev in the URL would make PUT and DELETE more consistent, and would allow you
to replace an existing JSON doc with another one without having to merge the _rev into it

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message