Dragon Arrow written by Tatsuya Nakaji, all rights reserved animated-dragon-image-0164

curl コマンド使い方

Mar 22, 2019

curlコマンドでURLにアクセスするとき

GETにアクセス(ビュー)

$ curl get_url


POSTにアクセス(投稿)

$ curl -X POST -H 'Content-Type:application/json' -d '{ "name": "username", "pwd": "password" }' post_url


DELETEにアクセス(削除)

$ curl -X DELETE delete_url


PUTにアクセス(新規作成or更新)

$ curl -X PUT -H "Content-Type: application/json" -d '{"user": {"name":"update_name", "age": "12345"}}' put_url


PATCHにアクセス(部分更新)

$ curl -X PATCH -H "Content-Type: application/json" -d '{"user": {"name":"update_name", "age": "12345"}}' patch_url