Dear Wiki user,

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

The "HTTP_view_API" page has been changed by MarcelloNuccio:
http://wiki.apache.org/couchdb/HTTP_view_API?action=diff&rev1=61&rev2=62

Comment:
added documentation of keys parameter.

  The following URL query arguments for '''GET/HEAD''' requests are allowed:
  ||'''Parameter''' ||'''Value''' ||'''Default value''' ||'''Description''' ||
  ||'''key''' ||''key-value'' ||''-'' ||'''Must''' be a proper URL encoded JSON 
value ||
+ ||'''keys''' ||''array of key-values'' ||''-'' ||'''Must''' be a proper URL 
encoded JSON array value ||
  ||'''startkey''' ||''key-value'' ||''-'' ||'''Must''' be a proper URL encoded 
JSON value ||
  ||'''startkey_docid''' ||''document id'' ||''-'' ||document id to start with 
(to allow pagination for duplicate startkeys) ||
  ||'''endkey''' ||''key-value'' ||''-'' ||'''Must''' be a proper URL encoded 
JSON value ||
@@ -125, +126 @@

  ||'''inclusive_end''' ||''true / false'' ||''true'' ||Controls whether the 
endkey is included in the result. It defaults to true. ||
  ||'''update_seq''' ||''true / false'' ||''false'' ||Response includes an 
'''update_seq''' value indicating which sequence id of the database the view 
reflects ||
  
- 
- 
- 
  Since 0.9 you can also issue '''POST''' requests to views where you can send 
the following JSON structure in the body:
  
  {{{
  {"keys": ["key1", "key2", ...]}
  }}}
- ''key'', ''startkey'', and ''endkey'' need to be properly JSON encoded 
values. For example, startkey="string" for a string value or startkey=["foo", 
1, {}]. Be aware that you have to do proper URL encoding on complex values.
  
  A JSON structure of ''{"keys": ["key1", "key2", ...]}'' can be posted to any 
user defined view or ''_all_docs'' to retrieve just the view rows matching that 
set of keys. Rows are returned in the order of the keys specified. Combining 
this feature with ''include_docs=true'' results in the so-called 
''multi-document-fetch'' feature.
+ 
+ The same response can be obtained using the ''keys'' parameter, but you need 
to URL encode the value. For example you can get two documents with ''_id''s 
''ID1'' and ''ID2'' from database ''DB'' with:
+ 
+ {{{
+ curl -v 
'http://localhost:5984/DB/_all_docs?keys=%5B%22ID1%22,%22ID2%22%5D&include_docs=true'
+ }}}
+ 
+ However, this may cause problems when caching is involved, because (as of 
today with 1.1.1) the Etag header returned by CouchDB does not change when you 
use `include_docs=true`.
+ 
+ ''key'', ''keys'', ''startkey'', and ''endkey'' need to be properly JSON 
encoded values. For example, startkey="string" for a string value or 
startkey=["foo", 1, {}]. Be aware that you have to do proper URL encoding on 
complex values.
  
  If you specify ''?limit=0'' you don't get any data, but all meta-data for 
this View. The number of documents in this View for example.
  

Reply via email to