How do I POST JSON data with cURL?

后端 未结 24 2984
刺人心
刺人心 2020-11-21 23:56

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

24条回答
  •  生来不讨喜
    2020-11-22 00:36

    I know, a lot has been answered to this question but wanted to share where I had the issue of:

    curl -X POST http://your-server-end-point -H "Content-Type: application/json" -d @path-of-your-json-file.json

    See, I did everything right, Only one thing - "@" I missed before the JSON file path.

    I found one relevant go-to document on internet - https://gist.github.com/subfuzion/08c5d85437d5d4f00e58

    Hope that might help the few. thanks

提交回复
热议问题