DEV Community

Alex Spinov
Alex Spinov

Posted on

HTTPie Has a Free API Testing Tool — And It Beats Postman for Quick Requests

Postman has become bloated. It wants to be a collaboration platform, a mock server, a documentation tool, and an API marketplace.

Sometimes you just want to hit an endpoint and see what comes back.

HTTPie: The API Tool That Does Less (And That's the Point)

HTTPie gives you two things:

  1. A CLI that makes curl readable
  2. A free web app for testing APIs visually

No account needed for the CLI. Free tier for the web app.

CLI: curl, But for Humans

# curl version
curl -s -H "Content-Type: application/json" \
  -H "Authorization: Bearer token123" \
  https://api.example.com/users | python3 -m json.tool

# HTTPie version
http GET api.example.com/users Authorization:"Bearer token123"
Enter fullscreen mode Exit fullscreen mode

Same result. Half the typing. Syntax-highlighted JSON output by default.

Install in 10 Seconds

# macOS
brew install httpie

# Linux
sudo apt install httpie

# Python (any OS)
pip install httpie
Enter fullscreen mode Exit fullscreen mode

Real Examples

GET with query params

http GET httpbin.org/get name==John age==30
Enter fullscreen mode Exit fullscreen mode

POST with JSON body

http POST httpbin.org/post name=John age:=30 active:=true
Enter fullscreen mode Exit fullscreen mode

Note: = for strings, := for numbers/booleans. HTTPie builds the JSON for you.

Upload a file

http --form POST httpbin.org/post file@./data.csv
Enter fullscreen mode Exit fullscreen mode

HTTPie vs curl vs Postman

Feature curl HTTPie Postman
Install size 2MB 15MB 400MB+
JSON formatting Manual Automatic Automatic
Syntax highlighting No Yes Yes
Account required No No (CLI) Yes
Offline use Yes Yes Partial
Learning curve Steep 5 min 30 min
Startup time Instant Instant 5-10 sec

Power Features Most People Miss

Sessions (persist auth across requests)

http --session=myapi POST api.example.com/login user=admin pass=secret
http --session=myapi GET api.example.com/dashboard
Enter fullscreen mode Exit fullscreen mode

Output control

http --print=HhBb GET api.example.com  # Full request+response
http --print=b GET api.example.com      # Body only
http --print=h GET api.example.com      # Headers only
Enter fullscreen mode Exit fullscreen mode

Try It Now

http GET httpbin.org/get
Enter fullscreen mode Exit fullscreen mode

I write about developer tools that save time. Follow for more.

Need automated API testing or web scraping? Email me at spinov001@gmail.com

Top comments (0)