メモです!!!
変数を保管するファイルを用意すると便利。
accessToken.txt
accessToken=iwe09qu0gq020f20q[jpjp2
リクエスト時のBodyも用意する。
body.json
{
"key1":"value1",
"key2":"value2",
"key3":"value3"
}
リクエストを送信するファイル
例では、YoutubeLiveBroadcast API にリクエストを送っている。
request.sh
. ./variables.txt
curl \
. ./accessToken.txt
curl --request POST \
'https://youtube.googleapis.com/youtube/v3/liveBroadcasts?part=snippet&part=id&part=contentDetails&part=status' \
--header "Authorization: Bearer ${accessToken}" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-binary "@C:\Users\****\apiRequestBody.json" \
--compressed
↧