You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Pulkit Singhal <pu...@gmail.com> on 2011/10/18 20:45:17 UTC

How to post multipart data to CouchDB?

Hello,

I read on the wiki here:
http://wiki.apache.org/couchdb/HTTP_Document_API?highlight=%28multipart%29

That:
As of 0.11 CouchDB supports handling of multipart/form-data encoded
updates. This is used by Futon and not considered a public API. All
such requests must contain a valid Referer header.

1) So now that I'm at version 1.1.0 ... its been a long time and I'm
hoping that this is now a public API? Yes? No?

2) If yes, then how is someone supposed to post a multipart document
to be indexed? Can someone please point me to an example of this being
done using curl?

Thanks You very much :)
- Pulkit

Re: How to post multipart data to CouchDB?

Posted by Jens Alfke <je...@couchbase.com>.
On Oct 18, 2011, at 11:45 AM, Pulkit Singhal wrote:

2) If yes, then how is someone supposed to post a multipart document
to be indexed? Can someone please point me to an example of this being
done using curl?

I’m not sure what you mean by “a multipart document”. Do you mean one with attachments? If so, you can add the attachment bodies in the JSON you post. See the “Inline Attachments” section on that same page. There’s also a way to send a multipart/related HTTP body, but I can’t see any documentation of it on the wiki.

(As far as I know, the multipart/form-data support is just there as a minor convenience for code that doesn’t want to pack the document up into JSON on its own. This seems like a small detail that shouldn’t prevent you from using any features.)

—Jens