2
0

More than 1 year has passed since last update.

POSTMANで作成したリクエストをスクリプトに変換

Posted at

例は Twitter API で curl に変換、windows10で使用

適当な request を開いて Code snippet を開く
リストからcurlを選択

設定 → Line continuation character →
 windows poerhesll(`)バッククォート
 コマンドプロンプト(^)
設定 → Quote Type → double

ちなみに Windows PoerShell だと動かない
参考:https://devadjust.exblog.jp/22690878/
→ "原因はエイリアス"の部分

PowerShell内では、Invoke-WebRequest という別コマンドが呼び出されていて、cURLと互換性がなく、一部パラメーターがエラーになるらしい。

記事に書いてあるけど、拡張子を指定するか、別名を解除する。

@rem OK
curl.exe --location --request -GET https://api.github.com/zen
@rem NG
curl --location --request -GET https://api.github.com/zen

スクリーンショット 2022-06-24 143734.png

便利..!!!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0