Without data:
curl --data '' https://example.com/resource.cgi
curl -X POST https://example.com/resource.cgi
curl --request POST https://example.com/resource.cgi
With fields:
curl --data "param1=value1¶m2=value2" https://example.com/resource.cgi
curl -i 'http://midominio.com/api/auth' -H 'Content-Type: application/hal+json' --data '{"_username": "miusername", "_password": "mipassword"}' -X POST
Multipart:
curl --form "fileupload=@my-file.txt" https://example.com/resource.cgi
curl -i 'http://midominio.com/api/survey/705/main-image' -H 'Content-Type: multipart/form-data' -H 'Token:xxxxxxxxxxxxxxxxxxxxxx' -F "image=@/ruta/a/mi/imagen.jpg" --compress
Multipart with fields and a filename:
curl --form "fileupload=@my-file.txt;filename=desired-filename.txt" --form param1=value1 --form param2=value2 https://example.com/resource.cgi
For large files, consider adding parameters to show upload progress: (The -o output is required, otherwise no progress bar will appear).
curl --tr-encoding -X POST -v -# -o output -T filename.dat \ http://example.com/resource.cgi