cURL #
Examples #
Get #
curl http://localhos:8080/albums
curl http://localhost:8080/albums/2
curl http://localhos:8080/albums --header "Content-Type: application/json" --request "GET"
Post #
curl <http://localhos:8080/albums> --include --header "Content-Type: application/json" --request "POST" --data '{"id": "4","title": "The Modern Sound of Betty Carter","artist": "Betty Carter","price": 49.99}'
curl -v -X POST localhost:4000/path -d 'name=NameValue -d 'key=KeyValue'
DELETE #
DELETERのBodyにデータをつけるには-Gオプションを使える。
curl -v -X DELETE localhost:4000/pash -G -d 'key=KEYVALUE'
miniforgeのダウンロード #
curl -L "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" -o "/home/$USERNAME/Miniforge3-Linux-x86_64.sh"
-o で出力ファイルを指定する。
RUSTのインストール #
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Goのダウンロード #
curl -L "https://go.dev/dl/go1.20.4.linux-amd64.tar.gz" -o "/home/$USERNAME/go.tar.gz"
nodeのダウンロード #
curl -L "https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz" -o "/home/$USERNAME/node18.tar.xz"
リダイレクトの追跡とファイル保存 #
wgetのようにファイル名を指定せずに保存するように使うには、
-LオプションでリダイレクトのLocationを追跡するのと、-Oオプションで保存ファイル名を指定せずにダウンロードするオプションをつける。
curl -LO アドレス