HTTPie as a cURL replacement

I’ve been giving HTTPie a try recently. It’s a command line HTTP client that aims to be simpler to use than cURL while providing a richer experience.

As an example, if you’re developing against a REST API it’s useful to send requests:

curl https://public-api.wordpress.com/rest/v1/sites/3584907/

curl-example

http https://public-api.wordpress.com/rest/v1/sites/3584907/

http_example

Now you can see what is happening! (although, it seems, I need a better terminal colour scheme)

You can certainly use tools such as jq to prettify cURL (or in the case of the WordPress.com API, pass ?pretty=1), but it’s built-in with HTTPie.

If it’s specifically JSON you want to see then you can use a Chrome extension such as JSONView may be easier still.

Although the above example is very simplistic, when you start digging into an API with HTTP verbs and authentication headers, HTTPie’s syntax is easier and less obscure than cURL.

How do you get this tool? Using brew you can just:

brew install httpie