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/10/11 19:04:39 UTC

[Couchdb Wiki] Update of "Document_Update_Handlers" by TimSmith

Dear Wiki user,

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

The "Document_Update_Handlers" page has been changed by TimSmith.
The comment on this change is: Describe POST usage as well as PUT.
http://wiki.apache.org/couchdb/Document_Update_Handlers?action=diff&rev1=11&rev2=12

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

  
  == Usage ==
  
- To invoke a handler, one must "PUT" the document against the handler function itself (POST does not seem to be supported). Using the canonical document URL won't invoke any handlers.
+ To invoke a handler, use one of:
+  * a PUT request against the handler function with a document id: `/<database>/_design/<design>/_update/<function>/<docid>`
+  * a POST request agasint the handler function without a document id: `/<database>/_design/<design>/_update/<function>`
  
- For example, to invoke the "in-place" handler defined above, the URL to use is:
+ For example, to invoke the `in-place` handler defined above, PUT to:
  
  {{{
  http://127.0.0.1:5984/<my_database>/_design/<my_designdoc>/_update/in-place/<mydocId>?field=title&value=test
@@ -86, +88 @@

  
  This means that unlike document validators, the user's intent must be clear by calling this individual handler explicitly. In this sense, you should think about an ''_update'' handler as complementary to ''_show'' functions, not to ''validate_doc_update'' functions.
  
+ For more information, look at ''update_documents.js'' in the test suite.
+ 
  == TBD ==
  
-  * Is POST supported, or only PUT?
-    * Maybe we should support PATCH?
+  * Maybe we should support PATCH?
   * Must fields be sent as URL query parameters, or can they be sent in the request representation?