You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Klaus Trainer (JIRA)" <ji...@apache.org> on 2010/08/18 04:32:16 UTC

[jira] Updated: (COUCHDB-642) Support rev in PUT URL

     [ https://issues.apache.org/jira/browse/COUCHDB-642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Klaus Trainer updated COUCHDB-642:
----------------------------------

    Attachment: 0001-Allow-for-the-current-revision-number-to-be.patch

The attached patch allows for specifying the revision number in the rev query parameter in an HTTP PUT request.

It will return status code 400 Bad Request if there are different revision numbers in the request body and the rev query parameter and/or the If-Match header.

To summarize, now there are three possibilities where to specify the revision number:
- rev query parameter
- If-Match header
- request body.
The revision numbers must be equal if specified at more than one place.

> Support rev in PUT URL
> ----------------------
>
>                 Key: COUCHDB-642
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-642
>             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@127.0.0.1:5984/briantest/foo
> {"ok":true,"id":"foo","rev":"1-967a00dff5e02add41819138abb3284d"}
> $ curl -X PUT -d "{}" http://brianadmin:brianadmin@127.0.0.1:5984/briantest/foo?rev=1-967a00dff5e02add41819138abb3284d
> {"error":"conflict","reason":"Document update conflict."}
> $ curl -X PUT -d '{"_rev":"1-967a00dff5e02add41819138abb3284d"}' http://brianadmin:brianadmin@127.0.0.1:5984/briantest/foo
> {"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 first.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.