tags:

views:

38

answers:

2

Is there a way to use curl to send a POST request without sending any data?

We usually post like:

curl --data @C:\mydata.txt http://1.2.3.4/myapi

If you omit the --data you are doing a GET. How can you omit it and still do a POST?

+1  A: 

This is a bit of a hack, but you could always provide an empty --data file.

Alternately

cat /dev/null | curl --data @- http://...
hemp
Right. Can also just use `--data xxx`..
Marcus
A: 

Randomly found the solution on another post:

curl -X POST http://example.com

Marcus