You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2009/03/22 09:43:47 UTC

[Couchdb Wiki] Update of "HTTP Document API" by JanLehnardt

Dear Wiki user,

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

The following page has been changed by JanLehnardt:
http://wiki.apache.org/couchdb/HTTP_Document_API

The comment on the change is:
remove MOVE docs

------------------------------------------------------------------------------
  
  == MOVE ==
  
+ For a ~6 month period CouchDB trunk between versions 0.8 and 0.9 included the nonstandard MOVE method. Since MOVE is really just COPY & DELETE and CouchDB can not reasonably guarantee atomicity between the COPY & MOVE operations on a single or on multiple nodes, this was removed before the release of CouchDB 0.9.
+  
- Note that this is a non-standard extension to HTTP.
- 
- You can move a document by sending an HTTP MOVE request. This allows you to make the contents (and attachments) of a document available under a different document id without first retrieving it from CouchDB. Use the ''Destination'' header to specify the document that you want to move to (the target document).
- 
- Since MOVE is a COPY & DELETE under the hood, you need to provide the revision id of the document you want to move.
- 
- It is not possible to move documents between databases and it is not (yet) possible to perform bulk move operations.
- 
- {{{
- MOVE /somedatabase/some_doc?rev=some_id HTTP/1.1
- Destination: some_other_doc
- }}}
- 
- If you want to overwrite an existing document, you need to specify the target document's revision with a ''rev'' parameter in the ''Destination'' header:
- 
- {{{
- MOVE /somedatabase/some_doc?rev=some_id HTTP/1.1
- Destination: some_other_doc?rev=rev_id
- }}}
- 
- The response in both cases includes the source and the target documents' new revisions:
- 
- {{{
- HTTP/1.1 201 Created
- Server: CouchDB/0.9.0a730122-incubating (Erlang OTP/R12B)
- Date: Mon, 05 Jan 2009 11:15:21 GMT
- Content-Type: text/plain;charset=utf-8
- Content-Length: 84
- Cache-Control: must-revalidate
- 
- {"ok":true,"new_revs":[{"id":"some_doc","rev":"4201149655"},{"id":"some_other_doc","rev":"3751914507"}]}
- }}}
- 
  
  == Attachments ==