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

What's the easiest way to do a JSON call from the command-line? I have a website that does a JSON call to retrieve additional data.

The Request Payload as shown in Google Chrome looks like this:

{"version": "1.1", "method":"progr","id":2,"params":{"call":...} }

It's about doing the call from (preferably) linux command line and retrieving the JSON content, not about parsing the incoming JSON data.

Answers


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


Need Your Help

xerces-c library function returns NULL when daemon ran via inetd

c++ xml linux xerces-c inetd

My application is an server application that accepts some predefined commands from user and displays respective output that is taken from XML files present at the server end.

Do not modify context even using a function that modifies the context

javascript class methods this

Maybe the title sounds a little bit weird (please improve it) -- but I need a solution for the following scenario. I have the following code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.