1

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?

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.