Method | PUT /db/_design/design-doc/attachment | |
Request | JSON of the design document | |
Response | JSON status statement | |
Admin Privileges Required | no | |
Query Arguments | Argument | rev |
Description | Current revision of the document for validation | |
Optional | yes | |
Type | string | |
HTTP Headers | Header | If-Match |
Description | Current revision of the document for validation | |
Optional | yes | |
Upload the supplied content as an attachment to the specified
design document (/_design/design-doc
). The
attachment
name provided must be a URL encoded
string. You must also supply either the rev
query argument or the If-Match
HTTP header for
validation, and the HTTP headers (to set the attacment content
type). The content type is used when the attachment is requested
as the corresponding content-type in the returned document header.
For example, you could upload a simple text document using the following request:
PUT http://couchdb:5984/recipes/_design/recipes/view.css?rev=7-f7114d4d81124b223283f3e89eee043e Content-Length: 39 Content-Type: text/plain div.recipetitle { font-weight: bold; }
Or by using the If-Match
HTTP header:
PUT http://couchdb:5984/recipes/FishStew/basic If-Match: 7-f7114d4d81124b223283f3e89eee043e Content-Length: 39 Content-Type: text/plain div.recipetitle { font-weight: bold; }
The returned JSON contains the new document information:
{ "id" : "_design/recipes" "ok" : true, "rev" : "8-cb2b7d94eeac76782a02396ba70dfbf5", }
Uploading an attachment updates the corresponding document revision. Revisions are tracked for the parent document, not individual attachments.