LoginSignup
9
5

More than 5 years have passed since last update.

cURLコマンドで膨大な行数のテキストデータを送る際にエラーとなる問題を解決

Last updated at Posted at 2017-01-14

1. 前提事項

  1. テキストデータはbase64エンコードした画像とする。
  2. curlコマンド実行時、-d オプションを用い、引数として1の情報を渡す。

2. エラー

実行コマンド

$ curl -s -X POST "http://www.xxx.com" -H "Content-Type:application/json" -d "Base64エンコードデータ.txt"

エラー内容

Argument list too long

3. 解決方法

パイプラインを用い、テキストデータを標準入力としてcurlコマンドに渡す。

$ echo "Base64エンコードデータ.txt" | curl -s -X POST "http://www.xxx.com" -H "Content-Type:application/json" -d @-

4. 参考

9
5
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
9
5