couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shorin <>
Subject Re: PUT json data
Date Fri, 17 Feb 2012 03:00:54 GMT
I suppose that you'd like to create multiple documents at one. Than
you have to use bulk api:

Otherwise you should PUT single object to document resource or use
POST request to let CouchDB setup document id, but in both cases data
source should not be an array of objects. E.g.

$ cat myfile.json
$ curl -X POST http://localhost:5984/foo/ -d @myfile.json -H
"Content-Type: application/json"


$ curl -X PUT http://localhost:5984/foo/bar -d @myfile.json -H
"Content-Type: application/json"

More information about Document API could be found there:


On Fri, Feb 17, 2012 at 6:34 AM, john.tiger <> wrote:
> something is wrong but seems right syntax
> myfile.json
> [{"name":"johndoe","created":"2012-02-16"},{"name":"marydoe","created":"2012-02-16"}]
> curl -X PUT -d @myfile.json -H
> "Content-Type:application/json"
> => not a valid json object

View raw message