I use Ubuntu and installed cURL on it. I want to test my Spring REST application with cURL. I wrote my POST code at the Java side. However, I want to test it with cURL. I am
Use -d option to add payload
curl -X POST \
http://:/ \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"foo": "bar",
"lorem": "ipsum"
}'
In addition:
use -X POST to use POST method
use -H 'Accept: application/json' to add accept type header
use -H 'Content-Type: application/json' to add content type header