Reputation: 3843
I am using this curl line, in order to trigger a POST request to my server:
curl --data "item=my_item&is_done=true" 127.0.0.1:5000/convert
How can i convert the curl line, in order to send the same parameters, but through JSON?
Upvotes: 1
Views: 93
Reputation: 564
You can use below command
curl -d ‘{“item”: “my_item”, “is_done”: ”true”}’ -H “Content-Type: application/json” -x POST 127.0.0.1:5000/convert
Or
If you want to share parameters in file abcd.json then ,
curl -d “@abcd.json” -H “Content-Type: application/json” -x POST 127.0.0.1:5000/convert
Upvotes: 1