Sunita Kumari
Sunita Kumari

Reputation: 23

Error "invalid json" in inserting document in Couchdb through command line

I am getting any "error: bad request,invalid json" while running

curl  -X PUT "http://localhost:5984/test" -d '{"valid":"json"}'

what to do for inserting document in database test through command line???

Upvotes: 0

Views: 877

Answers (1)

Daniel
Daniel

Reputation: 8368

When doing a PUT the _id of the document should be provided in the URL. So e.g.:

curl  -X PUT "http://localhost:5984/test/my-id" -d '{"valid":"json"}'

If you want Couch to generate the id, use a POST instead.

Upvotes: 1

Related Questions