I use Ubuntu and installed Curl on it. I want to test my Spring REST application with Curl. I wrote my POST code at Java side. However, I want to test it with Curl. I am trying to post a JSON data.
Any ideas about the right format of the Curl command?
You need to set your content-type to application/json. But -d sends the Content-Type application/x-www-form-urlencoded, which is not accepted on Spring's side. Looking at the curl man page, I think you can use -H:
From above, -H is short for --header, -d for --data. Note that -request POST is optional if you use -d, as the -d flag implies a POST request.