couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woh...@apache.org
Subject [couchdb-documentation] branch master updated: Add the POST _bulk_get endpoint (#263)
Date Thu, 22 Mar 2018 06:37:54 GMT
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-documentation.git


The following commit(s) were added to refs/heads/master by this push:
     new 02903bb  Add the POST _bulk_get endpoint (#263)
02903bb is described below

commit 02903bb65194519bcc6952df16a87fcfaf86867d
Author: Bruno Michel <brmichel@free.fr>
AuthorDate: Thu Mar 22 07:37:51 2018 +0100

    Add the POST _bulk_get endpoint (#263)
---
 src/api/database/bulk-api.rst | 126 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 126 insertions(+)

diff --git a/src/api/database/bulk-api.rst b/src/api/database/bulk-api.rst
index 5768d15..c7088e1 100644
--- a/src/api/database/bulk-api.rst
+++ b/src/api/database/bulk-api.rst
@@ -456,6 +456,132 @@ Sending multiple queries to a database
     The multiple queries are also supported in /db/_local_docs/queries and
     /db/_design_docs/queries (similar to /db/_all_docs/queries).
 
+.. _api/db/bulk_get:
+
+==================
+``/db/_bulk_get``
+==================
+
+.. http:post:: /{db}/_bulk_get
+    :synopsis: Fetches several documents at the given revisions
+
+    This method can be called to query several documents in bulk. It is well
+    suited for fetching a specific revision of documents, as replicators do for
+    example, or for getting revision history.
+
+    :param db: Database name
+    :<header Accept: - :mimetype:`application/json`
+    :<header Content-Type: :mimetype:`application/json`
+    :query boolean revs: Give the revisions history
+    :<json array docs: List of document objects, with ``id``, and optionnaly
+      ``rev`` and ``atts_since``
+    :>header Content-Type: - :mimetype:`application/json`
+    :>json object results: the documents, with the additionnal ``_revisions``
+      property that lists the parent revisions if ``revs=true``
+    :code 200: Request completed successfully
+    :code 400: The request provided invalid JSON data or invalid query parameter
+    :code 401: Read permission required
+    :code 404: Invalid database name
+    :code 415: Bad :header:`Content-Type` value
+
+    **Request**:
+
+    .. code-block:: http
+
+        POST /db/_bulk_get HTTP/1.1
+        Accept: application/json
+        Content-Type:application/json
+        Host: localhost:5984
+
+        {
+            "docs": [
+                {
+                    "id": "foo"
+                    "rev": "4-753875d51501a6b1883a9d62b4d33f91",
+                },
+                {
+                    "id": "foo"
+                    "rev": "1-4a7e4ae49c4366eaed8edeaea8f784ad",
+                },
+                {
+                    "id": "bar",
+                }
+            ]
+        }
+
+    **Response**:
+
+    .. code-block:: http
+
+        HTTP/1.1 200 OK
+        Cache-Control: must-revalidate
+        Content-Type: application/json
+        Date: Mon, 19 Mar 2018 15:27:34 GMT
+        Server: CouchDB (Erlang/OTP)
+
+        {
+          "results": [
+            {
+              "id": "foo",
+              "docs": [
+                {
+                  "ok": {
+                    "_id": "bbb",
+                    "_rev": "4-753875d51501a6b1883a9d62b4d33f91",
+                    "value": "this is foo",
+                    "_revisions": {
+                      "start": 4,
+                      "ids": [
+                        "753875d51501a6b1883a9d62b4d33f91",
+                        "efc54218773c6acd910e2e97fea2a608",
+                        "2ee767305024673cfb3f5af037cd2729",
+                        "4a7e4ae49c4366eaed8edeaea8f784ad"
+                      ]
+                    }
+                  }
+                }
+              ]
+            },
+            {
+              "id": "foo",
+              "docs": [
+                {
+                  "ok": {
+                    "_id": "bbb",
+                    "_rev": "1-4a7e4ae49c4366eaed8edeaea8f784ad",
+                    "value": "this is the first revision of foo",
+                    "_revisions": {
+                      "start": 1,
+                      "ids": [
+                        "4a7e4ae49c4366eaed8edeaea8f784ad"
+                      ]
+                    }
+                  }
+                }
+              ]
+            },
+            {
+              "id": "bar",
+              "docs": [
+                {
+                  "ok": {
+                    "_id": "bar",
+                    "_rev": "2-9b71d36dfdd9b4815388eb91cc8fb61d",
+                    "baz": true,
+                    "_revisions": {
+                      "start": 2,
+                      "ids": [
+                        "9b71d36dfdd9b4815388eb91cc8fb61d",
+                        "309651b95df56d52658650fb64257b97"
+                      ]
+                    }
+                  }
+                }
+              ]
+            }
+          ]
+        }
+
 .. _api/db/bulk_docs:
 
 ==================

-- 
To stop receiving notification emails like this one, please contact
wohali@apache.org.

Mime
View raw message