Open1

個人的によく使うcurlコマンドまとめ

eisukeeisuke

GET

curl http://localhost:8080

POST(json)

curl -X POST -H "Content-Type: application/json" -d '{"key1":"value1", "key2":"value2"}' http://localhost:8080/resource

POST(フォームデータ)

curl -X POST -d "param1=value1&param2=value2" http://localhost:8080/form

DELETE

curl -X DELETE http://localhost:8080/resource/id

PATCH

curl -X PATCH -H "Content-Type: application/json" -d '{"keyToUpdate":"newValue"}' http://localhost:8080/resource/id