POST /{db}/_all_docs
This request retrieves specified documents from the database.
Request
Request headers
This request does not have any required headers.
Query parameters
This request does not use query parameters.
Message body
The message body is a JSON document that contains the following object:
| Name | Type | Description |
|---|---|---|
keys | array | List of identifiers of the documents to retrieve |
Response
Status codes
- 200 OK – Request completed successfully
Response headers
Content-Type—The value can be:- application/json
- text/plain; charset=utf–8
Message body
The message body is a JSON document that contains the following objects:
| Name | Type | Description |
|---|---|---|
offset | integer | Starting index of the returned rows. |
rows | array | Array of row objects. Each row contains the following objects: id, key, and value. The value object contains the revision identifier in a rev object. |
total_rows | integer | Number of documents in the database.This number is not the number of rows returned. |
Example
The following request retrieves specified documents from the database named cookbook.
Request
POST /cookbook/_all_docs
Host: localhost:59840
{
"keys": [
"LemonChicken",
"209BB170-C1E0-473E-B3C4-A4533ACA3CDD"
]
}
Response
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 406
Content-Type: application/json
Date: Sun, 15 Dec 2013 21:38:59 GMT
Server: CouchbaseLite 1.486
{
"offset" : 0,
"rows" : [
{
"key" : "LemonChicken",
"value" : {
"rev" : "3-6210945863a15ee7eff1e540133d19da"
},
"id" : "LemonChicken"
},
{
"key" : "209BB170-C1E0-473E-B3C4-A4533ACA3CDD",
"value" : {
"rev" : "1-ed0ebedd2fab89227b352f6455a08010"
},
"id" : "209BB170-C1E0-473E-B3C4-A4533ACA3CDD"
}
],
"total_rows" : 2
}