use pipe for curl data

Solution 1:

I spent a while trying to figure this out and got it working with the following:

cat data.json | curl -H "Content-Type: application/json" -X POST --data-binary @- http://api

Solution 2:

You can use the magical stdin file /dev/stdin

cat data.json | curl -H "Content-Type: application/json" -X POST -d "$(</dev/stdin)" http://api