| Method | POST /db | |
| Request | JSON of the new document | |
| Response | JSON with the committed document information | |
| Admin Privileges Required | no | |
| Query Arguments | Argument | batch |
| Description | Allow document store request to be batched with others | |
| Optional | yes | |
| Type | string | |
| Supported Values | ||
ok | Enable | |
| Return Codes | ||
| 201 | Document has been created successfully | |
| 409 | Conflict - a document with the specified document ID already exists | |
Create a new document in the specified database, using the
supplied JSON document structure. If the JSON structure includes
the _id field, then the document will be
created with the specified document ID. If the
_id field is not specified, a new unique ID
will be generated.
For example, you can generate a new document with a generated UUID using the following request:
POST http://couchdb:5984/recipes/
Content-Type: application/json
{
"servings" : 4,
"subtitle" : "Delicious with fresh bread",
"title" : "Fish Stew"
}The return JSON will specify the automatically enerated ID and revision information:
{
"id" : "64575eef70ab90a2b8d55fc09e00440d",
"ok" : true,
"rev" : "1-9c65296036141e575d32ba9c034dd3ee"
}