Finding yourself using curl on the command line? Would like a convenient CLI HTTP client? Then look to HTTPie to help you interact with HTTP servers.

Httpie provide an interactive demo which you can start by running http to see options.

Installation

We require brew installed so if you need to install that we'll be waiting here for you.

With brew simply run brew install httpie and we'll soon be sending requests.

Examples

From tldr documentation the simplicity is apparent by and large due to the lack of specifying parameters for request type, form values or headers.

 - Send a GET request (default method with no request data):
   http {{https://example.com}}

 - Send a POST request (default method with request data):
   http {{https://example.com}} {{hello=World}}

 - Send a POST request with redirected input:
   http {{https://example.com}} < {{file.json}}

 - Send a PUT request with a given json body:
   http PUT {{https://example.com/todos/7}} {{hello=world}}

 - Send a DELETE request with a given request header:
   http DELETE {{https://example.com/todos/7}} {{API-Key:foo}}

 - Show the whole HTTP exchange (both request and response):
   http -v {{https://example.com}}

 - Download a file:
   http --download {{https://example.com}

A caveat

When we turn our attention to working on a server where, usually, an application container will provide only the binaries/libraries required in a mimalist fashion where it is likely that curl is available. With that being said there is a chance where curl is available due to, for example, a Dockerfile having installed this in the first place so if you'd like httpie on the application server it may not take too much effort to make httpie available.

Stick with what you know

While I find myself typing less characters on the command-line there is something to be said by the saying of 'stick wth what you know' and should you have comfort with curl already I'd suggest keeping with it.