You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by dc...@apache.org on 2012/11/18 20:19:39 UTC

[1/6] git commit: Add response object and view head info structure.

Updated Branches:
  refs/heads/docs 7723efc86 -> de2b2bbf4


Add response object and view head info structure.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/de2b2bbf
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/de2b2bbf
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/de2b2bbf

Branch: refs/heads/docs
Commit: de2b2bbf4f52692f1d454e1db0188a1785b297d6
Parents: 8cbe836
Author: Alexander Shorin <kx...@gmail.com>
Authored: Tue Nov 6 01:21:31 2012 +0400
Committer: Dave Cottlehuber <dc...@apache.org>
Committed: Sun Nov 18 20:19:18 2012 +0100

----------------------------------------------------------------------
 share/doc/src/json-structure.rst |   63 +++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/de2b2bbf/share/doc/src/json-structure.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/json-structure.rst b/share/doc/src/json-structure.rst
index 7b998f9..aaba09e 100644
--- a/share/doc/src/json-structure.rst
+++ b/share/doc/src/json-structure.rst
@@ -467,6 +467,48 @@ Request object
   }
 
 
+.. _response_object:
+
+Response object
+===============
+
++--------------------------------+---------------------------------------------+
+| Field                          | Description                                 |
++================================+=============================================+
+| code                           | HTTP status code `number`.                  |
++--------------------------------+---------------------------------------------+
+| json                           | JSON encodable `object`.                    |
+|                                | Implicitly sets `Content-Type` header as    |
+|                                | ``application/json``.                       |
++--------------------------------+---------------------------------------------+
+| body                           | Raw response text `string`.                 |
+|                                | Implicitly sets `Content-Type` header as    |
+|                                | ``text/html; charset=utf-8``.               |
++--------------------------------+---------------------------------------------+
+| base64                         | Base64 encoded `string`.                    |
+|                                | Implicitly sets `Content-Type` header as    |
+|                                | ``application/binary``.                     |
++--------------------------------+---------------------------------------------+
+| headers                        | Response headers `object`.                  |
+|                                | `Content-Type` header from this object      |
+|                                | overrides any implicitly assigned one.      |
++--------------------------------+---------------------------------------------+
+| stop                           | `boolean` signal to stop iteration over     |
+|                                | view result rows (for list functions only)  |
++--------------------------------+---------------------------------------------+
+
+.. warning::
+   ``body``, ``base64`` and ``json`` object keys are overlaps each other and
+   the last wins. Since most realizations of key-value objects doesn't preserve
+   key order mixing them may create confusing situation. Try to use only one of
+   them.
+
+.. note::
+   Any custom property makes CouchDB raise internal exception.
+   Also `Response object` could be a simple string value which would be
+   implicitly wrapped into ``{"body": ...}`` object.
+
+
 Returned CouchDB Document with Detailed Revision Info
 =====================================================
 
@@ -593,3 +635,24 @@ User Context Object
             "_admin"
         ]
     }
+
+
+.. _view_head_info_object:
+
+View Head Information
+=====================
+
++--------------------------------+---------------------------------------------+
+| Field                          | Description                                 |
++================================+=============================================+
+| total_rows                     | Number of documents in the view             |
++--------------------------------+---------------------------------------------+
+| offset                         | Offset where the document list started      |
++--------------------------------+---------------------------------------------+
+
+.. code-block:: javascript
+
+    {
+        "total_rows": 42,
+        "offset": 3
+    }