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 2010/05/07 21:52:59 UTC

[Couchdb Wiki] Trivial Update of "HTTP_Bulk_Document_API" by SebastianCohnen

Dear Wiki user,

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

The "HTTP_Bulk_Document_API" page has been changed by SebastianCohnen.
http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API?action=diff&rev1=8&rev2=9

--------------------------------------------------

     * By adding {{{?startkey="xx"&endkey="yy"}}} you can get the documents with keys in a certain range
     * By POSTing to _all_docs you can get a set of documents with arbitrary keys
  
+ 
+ Simple exmple to fetch the keys {{{bar}}} and {{{baz}}} and include the complete document in the result set:
  {{{
  curl -d '{"keys":["bar","baz"]}' -X POST http://127.0.0.1:5984/foo/_all_docs?include_docs=true
  }}}
  
+ Result:
  {{{#!highlight javascript
  {"total_rows":3,"offset":0,"rows":[
  {"id":"bar","key":"bar","value":{"rev":"1-4057566831"},"doc":{"_id":"bar","_rev":"1-4057566831","name":"jim"}},
@@ -22, +25 @@

  ]}
  }}}
  
+ Example with startkey and endkey ('''be aware''' of correct url encoding!):
  {{{
  curl 'http://127.0.0.1:5984/foo/_all_docs?include_docs=true&startkey="ba"&endkey="bb"'
  }}}
  
+ Result:
  {{{#!highlight javascript
  {"total_rows":3,"offset":0,"rows":[
  {"id":"bar","key":"bar","value":{"rev":"1-4057566831"},"doc":{"_id":"bar","_rev":"1-4057566831","name":"jim"}},
@@ -135, +140 @@

  $ curl -X PUT "$DB"
  }}}
  
+ Result:
  {{{#!highlight javascript
  {"ok":true}
  }}}
+ 
  {{{
  $ curl -X PUT -d '{"name":"fred"}' "$DB/person"
  }}}