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

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)