6.4. PUT /db/doc

6.4.1. Updating an Existing Document
MethodPUT /db/doc
Request JSON of the new document, or updated version of the existed document
Response JSON of the document ID and revision
Admin Privileges Requiredno
Query ArgumentsArgumentbatch
 Description Allow document store request to be batched with others
 Optionalyes
 Typestring
 Supported Values 
 okEnable
HTTP HeadersHeaderIf-Match
 DescriptionCurrent revision of the document for validation
 Optionalyes
   
Return Codes
201 Document has been created successfully
202 Document accepted for writing (batch mode)

The PUT method creates a new named document, or creates a new revision of the existing document. Unlike the POST method, you must specify the document ID in the request URL.

For example, to create the docment FishStew, you would send the following request:

PUT http://couchdb:5984/recipes/FishStew
Content-Type: application/json

{
  "servings" : 4,
  "subtitle" : "Delicious with fresh bread",
  "title" : "Fish Stew"
}

The return type is JSON of the status, document ID,and revision number:

{
   "id" : "FishStew",
   "ok" : true,
   "rev" : "1-9c65296036141e575d32ba9c034dd3ee"
}