Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2722

bash から API を操作するときのメモ

$
0
0
メモです!!! 変数を保管するファイルを用意すると便利。 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

Viewing all articles
Browse latest Browse all 2722

Trending Articles