shivams
shivams

Reputation: 2717

Uploading multiple documents to couchdb giving error

I have to upload bulk document into couchdb but this is not working and giving error. This is what i try to do with curl

curl -d '{"docs":[{"key":"baz","name":"bazzel"},{"key":"bar","name":"barry"}]}' -X POST http://127.0.0.1:5984/testdb/_bulk_docs

This is the error which comes for this

{"error":"bad_content_type","reason":"Content-Type must be application/json"}

This curl command is simple copy+paste from wiki of couchdb so ideally this should not be giving error. Is there anything that i am missing?

Upvotes: 1

Views: 259

Answers (1)

Ingo Radatz
Ingo Radatz

Reputation: 1225

Add the Header Content-Type application/json to your curl command. The flag is -H

e.g.

curl -H 'Content-Type: application/json' -d '{"docs":[{"key":"baz","name":"bazzel"},{"key":"bar","name":"barry"}]}' -X POST http://127.0.0.1:5984/testdb/_bulk_docs

Upvotes: 4

Related Questions