HTTPie makes talking to HTTP services easier
A new command line tool, HTTPie, is designed to make talking to HTTP services easier for developers. When working with a new HTTP-based API, developers may need to issue arbitrary commands to the API. This is often done using the curl tool, but the syntax of that is not ideal. For example, a call as a
put
method with a variable "hello" set to "world" could look like this:
curl -i -X PUT -H 'Content-Type:application/json; charset=utf-8'
-d '{"hello":"world"}' http://httpbin.org/put
As a command gets more complex, so the curl request gets more complex. The BSD-licensed HTTPie tool sets out to make the process a lot simpler, so that the above command is simplified to:
http PUT httpbin.org/put hello=world
HTTPpie also returns a colourised version of the response to make it easier to separate the data from the field names. The command line is made up of an HTTP Method for the request, a URL to send it to, and a list of
HTTPie vs curl
Source: HTTPie project
key-value pairs which can be headers (X-API-Token:1234), simple data items (hello=world) or JSON items (tests:=[10,20,30]). A single flag can turn requests into "form" requests. The request body can be taken from stdin, piped in from another command.
HTTPie is the work of Jakub Roztocil, is developed in Python and uses the Requests and Pygments libraries. It is available through pip and the Python Package Index, or through the project's Github repository.
(djwm)