I'm trying to learn CouchDB and I can create views and such in Futon, but I want to write my design documents on the desktop and the upload them using cURL. The 'Definitive Guide' shows updating content documents with cURL but all the design documents are either Futon or CouchApp.
I'd like to download the current design doc to a local file, edit the file, then send it back to CouchDB.
What are the cURL commands to download and upload CouchDB design documents?
Download the design file "task" in database "dev-task" to file "task.json" :
curl http://localhost:5984/dev-task/_design/task > task.json
Once the file is edited, you can put it back.
curl -X PUT http://localhost:5984/dev-task/_design/task -d @task.json
This works because task.json
contains an appropriate revision number. If you want to change the file again, you need to re-download it first to get the latest revision number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With