Madeline
Madeline

Reputation: 1079

how to post a json file with documents to couchdb

I am trying to post some documents to couchdb by curl and I have succeeded by choosing local file but not http-url... I have trying something like this:

curl -d @http://111.111.11.1/json/myjsonfile -X POST http://127.0.0.1:5984/MyTestDb/_bulk_docs -H "Content-Type: application/json"

I have been trying with many flags and tried many ways but I thing I am missing something. Is there anyone who can help?

Upvotes: 0

Views: 614

Answers (1)

Matt Jennings
Matt Jennings

Reputation: 1148

The -d option for curl expects a local file only. You'll have to download it first. You could try piping the output of a curl download to a PUT to your CouchDB:

curl http://111.111.11.1/json/myjsonfile | curl -d @- -X PUT http://localhost:5984/MyTestDb....

Upvotes: 1

Related Questions