Home > Network Management > http

Mastering the HTTPie Command

`httpie` is a command-line HTTP client that makes interaction with APIs and HTTP servers easy and intuitive. It offers a more user-friendly syntax than `curl`, along with features like automatic JSON support and syntax highlighting. It is primarily used for API testing, debugging, and communicating with web services.

Main Options

`httpie` allows you to naturally combine HTTP methods, URLs, and request data in the form of `key=value`. Use the options below to create various types of HTTP requests.

1. Basic Requests and Data

2. Headers and Authentication

3. Output and Others

Generated command:

Try combining the commands.

Description:

`http` Executes the command.

Combine the above options to virtually execute commands with AI.

Installing HTTPie

`httpie` is Python-based, so using `pip` is the most common method of installation. Refer to the methods below for installation on various operating systems.

Python pip

python3 -m pip install --upgrade pip wheel
python3 -m pip install httpie

This shows how to install using `pip`, the package manager for Python.

Debian/Ubuntu

sudo apt update
sudo apt install httpie

This shows how to install using `apt` on Debian or Ubuntu-based systems.

CentOS/RHEL/Fedora

sudo dnf install httpie

This shows how to install using `dnf` or `yum` on CentOS, RHEL, or Fedora-based systems.

macOS (Homebrew)

brew install httpie

This shows how to install using Homebrew on macOS.

Commonly Used Examples

`httpie` allows you to easily implement real API call scenarios thanks to its intuitive syntax.

Check Web Page Content (GET)

http https://www.google.com

Outputs the HTML content of the Google homepage to the terminal.

Send JSON Data to API (POST)

http POST https://api.example.com/users name=John age:=30

Sends a POST request with JSON data to the API endpoint.

File Download

http --download https://example.com/data.zip

Downloads a file from a remote server to the current directory.

Check Response Headers

http -h https://www.google.com

Outputs only the response headers for the request, omitting the body.

Preview Request Content

http --offline POST https://api.example.com/test id:=1

Outputs the headers and body of the request that will be sent without actually sending it.


Related commands

These are commands that are functionally similar or are commonly used together.


Same category commands