From dev-return-17927-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Thu Sep 1 16:14:35 2011 Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 29ADA8017 for ; Thu, 1 Sep 2011 16:14:35 +0000 (UTC) Received: (qmail 65797 invoked by uid 500); 1 Sep 2011 16:14:34 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 65734 invoked by uid 500); 1 Sep 2011 16:14:33 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 65726 invoked by uid 99); 1 Sep 2011 16:14:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2011 16:14:33 +0000 X-ASF-Spam-Status: No, hits=-2000.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2011 16:14:30 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id C222C4A337 for ; Thu, 1 Sep 2011 16:14:09 +0000 (UTC) Date: Thu, 1 Sep 2011 16:14:09 +0000 (UTC) From: "gert cuykens (JIRA)" To: dev@couchdb.apache.org Message-ID: <1239422424.7145.1314893649791.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <534061796.5108.1314835029843.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (COUCHDB-1268) "?rev=" URL query parameter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COUCHDB-1268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13095373#comment-13095373 ] gert cuykens commented on COUCHDB-1268: --------------------------------------- I am not experienced enough to come up with better arguments, except for compatibility between other document based databases maybe. I trust you will have better judgment on this. > "?rev=" URL query parameter > --------------------------- > > Key: COUCHDB-1268 > URL: https://issues.apache.org/jira/browse/COUCHDB-1268 > Project: CouchDB > Issue Type: Improvement > Components: Database Core > Affects Versions: 1.2 > Environment: linux > Reporter: gert cuykens > Priority: Trivial > Labels: api-change > Original Estimate: 24h > Remaining Estimate: 24h > > When PUTting a document you have to specify the current revision as a _rev key in the JSON; whereas many related requests (like DELETE, COPY and PUT of an attachment) specify the revision in a "?rev=" URL query parameter instead. The first example, will result into a document conflict because rev is not specified in the JSON and the rev from the url gets ignored. All other examples work. I strongly believe JSON bodies like this should never contain _id and _rev and will improve in much better client code. > curl -X PUT http://localhost:5984/_users/user%3Agert?rev=5xxx -H > 'Content-Type: application/json' -d{ > "_id" : "user:gert", > "type" : "user", > "name" : "gert", > "roles" : [], > "password_sha" : "", > "salt" : "" > }' > curl -X PUT http://localhost:5984/_users/user%3Agert -H 'Content-Type: > application/json' -d{ > "_id" : "user:gert", > "_rev":"5xxx", > "type" : "user", > "name" : "gert", > "roles" : [], > "password_sha" : "", > "salt" : "" > }' > curl -X PUT http://localhost:5984/_users/user%3Agert/picture?rev=5xxx > -H 'Content-Type: image/png' -d @picture.png -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira