You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/03/22 06:37:53 UTC
[GitHub] wohali closed pull request #263: Add the POST _bulk_get endpoint
wohali closed pull request #263: Add the POST _bulk_get endpoint
URL: https://github.com/apache/couchdb-documentation/pull/263
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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:
==================
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services