DELETE /{db}/{doc}
This request deletes a document from the database. When a document is deleted, the revision number is updated so the database can track the deletion in synchronized copies.
Request
Request headers
-
Accept—optional—Valid values are:- application/json
- text/plain
-
If-Match– Required if therevquery parameter is not supplied —Revision identifier of the requested document.
Query parameters
| Name | Type | Description | Default |
|---|---|---|---|
batch
| string | Stores the document in batch mode. To use, set the value to ok. | none |
rev
| string | Revision identifier | none |
Message body
None
Response
Status codes
- 200 OK – Document successfully removed
- 202 Accepted – Request was accepted, but changes are not yet stored on disk
- 400 Bad Request – Invalid request body or parameters
- 401 Unauthorized – Write privileges required
- 404 Not Found – Specified database or document ID doesn’t exists
- 409 Conflict – Specified revision is not the latest for target document
Response headers
-
Content-Type—The value can be:- application/json
- text/plain; charset=utf-8
-
ETag—Revision identifier enclosed in double quotes
Message body
The response is a JSON document that contains the following objects:
| Name | Type | Description |
|---|---|---|
id
| String | Document identifier |
ok
| Boolean | Indicates whether the operation was successful |
rev
| String | revision identifier |
Example
Request
DELETE /cookbook/ButterChicken?rev=2-1b76d07281d4a576130c7d8f9f621d5e HTTP/1.1
Host: localhost:59840
Response
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Type: application/json
Date: Fri, 13 Dec 2013 20:52:38 GMT
Etag: "3-7c9a006fb9938b0994cb06a9c11521e7"
Server: CouchbaseLite 1.486
Transfer-Encoding: chunked
{
"id" : "ButterChicken",
"rev" : "3-7c9a006fb9938b0994cb06a9c11521e7",
"ok" : true
}