cURL Beispiele

GET

~ » curl http://127.0.0.1:5984/
{"couchdb":"Welcome","uuid":"01be454b6ac1392bedd9aa6723b857a3","version":"1.6.1","vendor":{"name":"Homebrew","version":"1.6.1_9"}}
~ » curl http://localhost:5984/anotherdb/_all_docs                                                                                                                                                                                                                     pat@imac
{"total_rows":1,"offset":0,"rows":[
{"id":"ea224c12ea5bcf39ab8227a6fa0007dd","key":"ea224c12ea5bcf39ab8227a6fa0007dd","value":{"rev":"1-7f4b03dfd1b82fbfa61e641f6993c9d5"}}
]}
~ » curl http://127.0.0.1:5984/ -o out.json
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100   131  100   131    0     0  23002      0 --:--:-- --:--:-- --:--:-- 26200
~ »

POST

~ » curl -H "Content-Type: application/json" --data "{\"message\":\"half truth\",\"value\":21,\"truth\":false}" http://127.0.0.1:5984/anotherdb                                                                                                                         pat@imac
{"ok":true,"id":"ea224c12ea5bcf39ab8227a6fa0007dd","rev":"1-7f4b03dfd1b82fbfa61e641f6993c9d5"}

PUT

~ » curl -X PUT http://127.0.0.1:5984/anotherdb                                                                                                                                                                                                                        pat@imac
{"ok":true}

DELETE

~ » curl -X DELETE http://127.0.0.1:5984/anotherdb                                                                                                                                                                                                                     pat@imac
{"ok":true}

Schreiben Sie einen Kommentar