How to do HTTP-request/call with JSON payload from command-line?

Solution 1:

You could use wget as well:

wget -O- --post-data='{"some data to post..."}' \
  --header='Content-Type:application/json' \
  'http://www.example.com:9000/json'

Calling wget with the option -O providing the - (space in between will be ignored, so it could also be written as -O -) to it as its value will cause wget to output the HTTP response directly to standard output instead into a file. The long option name for that is --output-document=file.

Solution 2:

Use curl, assuming the data is POST'ed, something like

curl -X POST http://example.com/some/path -d '{"version": "1.1", "method":"progr","id":2,"params":{"call":...} }'

If you're just retrieving the data with a GET , and don't need to send anything bar URL parameters, you'd just run curl http://example.com/some/path