GET /{db}/{local-doc-id}
This request retrieves a local document.
Request
Request headers
-
Accept—optional—Valid values are:- application/json
- multipart/mixed
- text/plain
-
If-None-Match—optional—Document revision identifier enclosed in double quotes
Query parameters
The following query parameters are all optional.
| Name | Type | Description | Default |
|---|---|---|---|
attachments
| Boolean | Include attachment bodies in response | false |
att_encoding_info
| Boolean | Include encoding information in attachment stubs if the attachment is compressed | false |
atts_since
| array | Include attachments only since specified revisions. Does not include attachments for specified revisions | none |
conflicts
| Boolean | Include information about conflicts in document | false |
deleted_conflicts
| Boolean | Include information about deleted conflicted revisions | false |
latest
| Boolean | Force retrieval of latest leaf revision, no matter what revision was requested | false |
local_seq
| Boolean | Include last update sequence number for the document | false |
meta
| Boolean | Acts same as specifying all conflicts, deletedconflicts and openrevs query parameters | false |
open_revs
| array | Retrieve documents of specified leaf revisions. You can specify the value all to return all leaf revisions | none |
rev
| string | Retrieve the specified revision of the document | none |
revs
| Boolean | Include a list of all known document revisions | false |
revs_info
| Boolean | Include detailed information for all known document revisions | false |
Response
The response contains a JSON document in the message body.
Response headers
-
Content-Type—The value can be:- application/json
- multipart/mixed
- text/plain; charset=utf-8
-
ETag—Document revision identifier contained in double quotes. -
Transfer-Encoding—This header appears when the request uses theopen-revsquery parameter. The value ischunked.
Message body
The message body contains the following objects in a JSON document.
| Name | Type | Description |
|---|---|---|
_id
| string | Document identifier |
_rev
| string | revision identifier |
_deleted
| Boolean | Indicates whether the document is deleted. Appears only when the document was deleted. |
_attachments
| object | Stubs for the attachments. Appears only when the document has attachments. |
_conflicts
| array | List of revisions with conflicts. Appears only when the request uses the conflicts=true query parameter. |
_deleted_conflicts
| array | List of revisions with conflicts that were deleted. Appears only when the request uses the deleted_conflicts=true query parameter. |
_local_seq
| integer | Sequence number of the document in the database. Appears only when the request uses the local_seq=true query parameter. |
_revs_info
| array | List of objects with information about local revisions and their status. Appears only when the request uses the open_revs=true query parameter. |
_revisions
| object | List of local revision identifiers. Appears only when the request uses the revs=true query parameter. |
Example
The following example retrieves a local document with the identifier _local/RecipeLists from a database named cookbook.
Request
GET /cookbook/_local/RecipeLists
Host: localhost:59840
Response
{
"_id": "_local/RecipeLists",
"_rev": "2-local",
"favorite-recipes": [
"LemonChicken",
"ChickenParm",
"ChickenSoup"
],
"recipes-to-try": [
"BLTSalad",
"PastaPrimavera",
"ChocolateBundtCake",
"Milanesas",
"BarleyVeggieSoup"
]
}