DELETE /{db}/{local-doc-id}
This request deletes a local document.
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 document to delete.
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
The following example deletes a local document with the identifier _local/RecipeLists and revision identifier 2-local from a database named cookbook.
Request
DELETE /cookbook/_local/RecipeLists?rev=2-local HTTP/1.1
Host: localhost:59840
Response
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Type: application/json
Date: Mon, 21 Apr 2014 21:28:11 GMT
Etag: "(null)"
Server: CouchbaseLite 1.495
Transfer-Encoding: chunked
{
"id" : "_local/RecipeLists",
"ok" : true
}