/usr/bin/curl: Argument list too long


You may see the following error when you send a http/https request with curl command. Here is some tips to fix it.

-bash: /usr/bin/curl: Argument list too long

If it is a POST request, could try to wrap it into a file.

curl -X POST -d @filename.txt https:/YOUR_URL/

# or
cat filename.txt | curl -X POST http://YOUR_URL/ -H 'Content-Type:applicatin/json' -d @-

Or use httpie to replace curl to send request.

pip install httpie

## Raw JSON
echo '{"hello": "world"}' | http POST example.com/post

## Parameters

http POST https://example.com/posts/2 \
    Origin:example.com \  # :   HTTP headers
    name="John Doe" \     # =   string
    q=="search" \         # ==  URL parameters (?q=search)
    age:=29 \             # :=  for non-strings
    list:='[1,3,4]' \     # :=  json
    file@file.bin \       # @   attach file
    token=@token.txt \    # =@  read from file (text)
    user:=@user.json      # :=@ read from file (json)

## Forms
http --form POST example.com \
    name="John Smith" \

Small world. Big idea!
  • Welcome to visit the knowledge base of SRE and DevOps!
  • License under CC BY-NC 4.0
  • Made with Material for MkDocs and improve writing by generative AI tools
  • Copyright issue feedback me#imzye.com, replace # with @