A Modern and User-Friendly CLI HTTP Terminal for API Era

april
5 min readOct 20, 2022
A Modern and User-friendly CLI HTTP Client for API Era

HTTPie (pronounced aitch-tee-tee-pie) is a command-line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible. HTTPie is designed for testing, debugging, and generally interacting with APIs & HTTP servers. The HTTP & HTTPS commands allow for creating and sending arbitrary HTTP requests. They use simple and natural syntax and provide formatted and colorized output.

Stars: 24.3k
Platforms: Windows, Linux, macOS
License: BSD-3-Clause
Languages: Python(92.4%), Roff(5.1%)
Link: https://github.com/httpie/httpie

Main Features

  • Expressive and intuitive syntax
  • Formatted and colorized terminal output
  • Built-in JSON support
  • Forms and file uploads
  • HTTPS, proxies, and authentication
  • Arbitrary request data
  • Custom headers
  • Persistent sessions
  • Wget-like downloads
  • Linux, macOS, Windows, and FreeBSD support
  • Plugins
  • Documentation
  • Test coverage

Usage

Synopsis:

http [flags] [METHOD] URL [ITEM [ITEM]]

Usage:

http
usage: http
[--json] [--form] [--multipart] [--boundary BOUNDARY]
[--raw RAW] [--compress]
[--pretty {all,colors,format,none}] [--style STYLE]
[--unsorted] [--sorted] [--response-charset ENCODING]
[--response-mime MIME_TYPE]
[--format-options FORMAT_OPTIONS] [--print WHAT]
[--headers] [--meta] [--body] [--verbose] [--all]
[--history-print WHAT] [--stream] [--output FILE]
[--download] [--continue] [--quiet]
[--session SESSION_NAME_OR_PATH |
--session-read-only SESSION_NAME_OR_PATH]
[--auth USER[:PASS] | TOKEN]
[--auth-type {basic,bearer,digest,edgegrid}]
[--ignore-netrc] [--offline]
[--proxy PROTOCOL:PROXY_URL]
[--follow] [--max-redirects MAX_REDIRECTS]
[--max-headers MAX_HEADERS] [--timeout SECONDS]
[--check-status] [--path-as-is] [--chunked]
[--verify VERIFY] [--ssl {ssl2.3,tls1,tls1.1,tls1.2}]
[--ciphers CIPHERS] [--cert CERT] [--cert-key CERT_KEY]
[--ignore-stdin] [--help] [--version] [--traceback]
[--default-scheme DEFAULT_SCHEME] [--debug]
[METHOD] URL [REQUEST_ITEM ...]
http: error: the following arguments are required: URL

Examples

  • Custom HTTP method, HTTP headers, and JSON data:
$ http PUT pie.dev/put X-API-Token:123 name=John
  • Submitting forms:
$ http -f POST pie.dev/post hello=World
  • See the request that is being sent using one of the output options:
$ http -v pie.dev/get
  • Build and print a request without sending it using offline mode:
$ http --offline pie.dev/post hello=offline
  • Use GitHub API to post a comment on an issue with authentication:
$ http -a USERNAME POST https://api.github.com/repos/httpie/httpie/issues/83/comments body='HTTPie is awesome! :heart:'
  • Upload a file using redirected input:
$ http pie.dev/post < files/data.json
  • Download a file and save it via redirected output:
$ http pie.dev/image/png > image.png
  • Download a file wget style:
$ http --download pie.dev/image/png
  • Use named sessions to make certain aspects of the communication persistent between requests to the same host:
$ http --session=logged-in -a username:password pie.dev/get API-Key:123$ http --session=logged-in pie.dev/headers
  • Set a custom Host header to work around missing DNS records:
$ http localhost:8000 Host:example.com

HTTPie Web & Desktop APP

All the user-friendliness of the Terminal version is now wrapped up in a sleek graphical interface.

HTTPie command generation

You can export code and commands for many other languages and tools, including the highly requested cURL, HAR, JavaScript, Node, Java, PHP, Objective-C, Swift, Python, Ruby, C#, Go, OCaml, and more.

A Modern and User-friendly CLI HTTP Client for API Era

Organize your work in spaces, collections, and tabs

Spaces (short for workspaces) are containers for your projects. Each space is its own universe with a library, collections, saved requests, drafts, open tabs, and variables. You can create as many spaces as you need.

A Modern and User-friendly CLI HTTP Client for API Era

Parametrize requests with variables and environments

Define variables inside the current space’s detail tab. Then you can reference them from any request or collection within the space via {{NAME}}.

A Modern and User-friendly CLI HTTP Client for API Era

Mark a variable as secret, and we’ll mask its values in the variable list so that you don’t accidentally share them on a Zoom call.

A Modern and User-friendly CLI HTTP Client for API Era

Environments allow you to quickly swap between different contexts. A common practice is to have an API running in different environments. You can create as many environments as you like and switch between them using the menu at the top right of the app.

A Modern and User-friendly CLI HTTP Client for API Era

Auto-save and real-time sync

As long as you are not incognito, your data is backed up and synchronized across your devices. When you change something, it’s instantly updated on your other clients. And you don’t have to worry about hitting save because it continuously auto-saves your work.

A Modern and User-friendly CLI HTTP Client for API Era

Search in any message

With the help of the search, you won’t feel like you’re looking for a needle in a haystack. Search is available everywhere where long content can appear: In the body editor and the preview, request, and response panels.

A Modern and User-friendly CLI HTTP Client for API Era

Quickly toggle the response preview

When the server sends back a response type for which there’s a human-friendly preview mode, such as HTML, we render the response to make it easier to digest.

A Modern and User-friendly CLI HTTP Client for API Era

Navigate APIs faster with interactive URLs

It’s only natural for HTTPie to make URLs interactive so that you, as a human, can conveniently flow through APIs as well. HTTPie makes URLs interactive in all contexts, including the request body editor, headers, and other places where URLs can be expected to occur.

A Modern and User-friendly CLI HTTP Client for API Era

--

--

april

Senior Engineer. Ailurophile. I write about programming, open source project, productivity and more.