Request URL

The only information HTTPie needs to perform a request is a URL.The default scheme is, somewhat unsurprisingly, http://,and can be omitted from the argument – http example.org works just fine.

Querystring parameters

If you find yourself manually constructing URLs with querystring parameterson the terminal, you may appreciate the param==value syntax for appendingURL parameters.

With that, you don't have to worry about escaping the &separators for your shell. Additionally, any special characters in theparameter name or value get automatically URL-escaped(as opposed to parameters specified in the full URL, which HTTPie doesn’tmodify).

  1. $ http https://api.github.com/search/repositories q==httpie per_page==1
  1. GET /search/repositories?q=httpie&per_page=1 HTTP/1.1

URL shortcuts for localhost

Additionally, curl-like shorthand for localhost is supported.This means that, for example :3000 would expand to http://localhost:3000If the port is omitted, then port 80 is assumed.

  1. $ http :/foo
  1. GET /foo HTTP/1.1
  2. Host: localhost
  1. $ http :3000/bar
  1. GET /bar HTTP/1.1
  2. Host: localhost:3000
  1. $ http :
  1. GET / HTTP/1.1
  2. Host: localhost

Other default schemes

When HTTPie is invoked as https then the default scheme is https://($ https example.org will make a request to https://example.org).

You can also use the —default-scheme <URL_SCHEME> option to createshortcuts for other protocols than HTTP (possibly supported via plugins).Example for the httpie-unixsocket plugin:

  1. # Before
  2. $ http http+unix://%2Fvar%2Frun%2Fdocker.sock/info
  1. # Create an alias
  2. $ alias http-unix='http --default-scheme="http+unix"'
  1. # Now the scheme can be omitted
  2. $ http-unix %2Fvar%2Frun%2Fdocker.sock/info