HTTPie API Debugging: Test and Inspect HTTP Requests

Quick Linux Tip #130:

Question: How do I debug an HTTP API quicker than with curl?

Try: http --print=HBhb --verify=yes https://api.example.com/users/42

Info: Prints colored request and response headers and bodies, making HTTP API debugging easier and more readable.

Examples:

  • $ http POST api.example.com/users name=John age:=34  # Send JSON body with typed values
  • $ http --session=api api.example.com/me Authorization:'Bearer TOKEN'  # Persist authentication and session state
  • $ http --download https://example.com/file.zip  # Download files with a progress bar

Note: Install via sudo apt install httpie. HTTPie formats JSON automatically, simplifies headers and authentication, and provides a clean alternative to curl for API testing. Avoid storing real access tokens in shared or unprotected session files.




LinuxTeck.com
linuxteck:~$ http --print=HBhb --verify=yes https://api.example.com/users/42
GET /users/42 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: api.example.com
User-Agent: HTTPie/3.2.2

{
    "age": 34,
    "email": "john@example.com",
    "id": 42,
    "name": "John Smith"
}

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 87
Date: Mon, 09 Nov 2026 11:34:56 GMT
Server: nginx/1.24.0
X-RateLimit-Remaining: 99
X-Response-Time: 23ms

{
    "id": 42,
    "name": "John Smith",
    "email": "john@example.com",
    "age": 34
}
linuxteck:~$

PREVIOUS ARTICLE Quick Linux Tip #129: Linux Network Namespace: Create an Isolated Network Stack
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.