Reputation: 528
I use simple shell script to test some http server that process POST requests. Usually it looks like:
echo "param1=value1¶m2=value2" | POST localhost/service
But now I want to pass also some json in POST body and that's where I missing point completely.
man POST and google did't help much also.
Seems it must be either very simple or completely impossible.
Thanks for help.
Upvotes: 8
Views: 5973
Reputation: 41433
Either I'm missing something, or you should do
$ echo -n '{"json":"data"}' | POST -c "application/json" 'http://localhost/service?param1=value1¶m2=value2'
If you need to put those parameters not as GET, but as POST as well, then look up multipart form data.
Upvotes: 5
Reputation: 6316
You probably need to pass content type using -c:
POST -c application/json
Upvotes: 1