By CenturyLink Cloud Product Management
Make no mistake: for people who hack on UNIX-based systems,
curl is a really powerful command. It enables you to extract the client-side content of any web page in an instant and also to do all kinds of things with the result, like dumping it into a .txt file (a trick which has been extremely useful to me in learning web development).
But the curl command doesn’t always function all that intuitively on the input side, and the output always comes out monochromatic, making it difficult to immediately discern what’s going on in the stream of text you’re presented with in the CLI.
HTTPie, in the words of its creator, was built “out of frustration with existing tools.” It provides the capacity to make both more intuitive requests and polychromatic output. Using it couldn’t be any more simple. The commands underlying an HTTPie request look like this in generic form:
http [flags] [METHOD] URL [items]
Let’s have a look at a sample POST request (taken from HTTPie’s GitHub readme):
http --form POST api.example.org/person/1 name=’John Smith’ firstname.lastname@example.org
The equivalent request done with the curl command:
curl --data “name=John+Smith&email=john%40example.org” api.example.org/person/1
Requests in HTTPie aren’t necessarily significantly less verbose than curl requests. But that’s not their primary function. The benefit of...