HTTPie CLI — Modern User-Friendly Command-Line HTTP Client
HTTPie is a modern, user-friendly command-line HTTP client for the API era. Intuitive syntax, formatted and colorized output, JSON support, sessions, authentication, file uploads, and plugins. The friendly alternative to curl for API exploration.
这个资产会安全暂存
这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。
npx -y tokrepo@latest install 224cd323-35d4-11f1-9bc6-00163e2b0d79 --target codex先暂存文件;激活前需要读取暂存 README 和安装计划。
What it is
HTTPie is a command-line HTTP client designed for API exploration and testing. It provides an intuitive syntax where headers, query parameters, and JSON data are expressed naturally. Output is automatically formatted and colorized, making API responses readable without piping through jq.
HTTPie targets developers, QA engineers, and anyone who works with HTTP APIs from the terminal. If you find curl's flag syntax hard to remember, HTTPie offers a more ergonomic alternative with sensible defaults.
How it saves time or tokens
This workflow provides installation commands and common usage patterns. Instead of looking up curl flags for POST requests with JSON bodies, you get a natural syntax where http POST url key=value does the right thing. Sessions persist cookies and headers across requests, eliminating repetitive authentication headers.
How to use
- Install HTTPie:
# macOS
brew install httpie
# Debian/Ubuntu
sudo apt install httpie
# Python
pip install httpie
- Make requests with intuitive syntax:
# GET request
http httpbin.org/get
# POST JSON data
http POST httpbin.org/post name=John age:=30 admin:=true
# Custom headers
http httpbin.org/headers Authorization:'Bearer token123'
# Download a file
http --download https://example.com/file.zip
- Use sessions for persistent state:
# Create a named session
http --session=myapi POST api.example.com/login username=admin password=secret
# Subsequent requests reuse cookies and headers
http --session=myapi api.example.com/dashboard
Example
# API testing workflow
# 1. Authenticate and save session
http --session=dev POST https://api.example.com/auth/login \
email=dev@example.com password=secret
# 2. Create a resource (session carries auth cookie)
http --session=dev POST https://api.example.com/items \
name='New Item' category='tools' price:=29.99
# 3. List resources with query params
http --session=dev https://api.example.com/items \
page==1 per_page==20 sort==created_at
# 4. Upload a file
http --session=dev POST https://api.example.com/upload \
file@./document.pdf
Related on TokRepo
- API tools -- Tools for building and testing APIs
- Automation tools -- CLI-based workflow automation
Common pitfalls
- HTTPie uses
=for string values and:=for raw JSON (numbers, booleans, arrays). Using=for a number sends it as a string, which may cause API validation errors. - The
==operator is for query parameters, not equality.http url page==2adds?page=2to the URL. - HTTPie defaults to JSON content type for POST requests. To send form data instead, use the
--formflag.
常见问题
HTTPie provides a more intuitive syntax, automatic JSON formatting, colorized output, and built-in session management. curl is more versatile for low-level HTTP operations and scripting. HTTPie focuses on developer ergonomics for API testing.
Yes. HTTPie supports Basic auth (--auth user:pass), Bearer tokens (Authorization:Bearer token), digest auth, and custom authentication via plugins. Sessions persist auth headers across requests.
Yes. Use --print=b for body-only output, --check-status to fail on HTTP errors, and --quiet for silent mode. HTTPie returns appropriate exit codes for scripting and can output raw responses without formatting.
Yes. HTTPie handles HTTPS by default, verifying SSL certificates. Use --verify=no to skip verification for self-signed certificates during development.
Yes. HTTPie offers a desktop application and web-based interface at httpie.io. The GUI provides the same intuitive experience with a visual request builder. The CLI and GUI share the same core engine.
引用来源 (3)
- HTTPie GitHub— HTTPie is a modern command-line HTTP client
- HTTPie Documentation— Intuitive syntax with colorized output and JSON support
- HTTPie Sessions— Session management for persistent cookies and headers
讨论
相关资产
LLxprt Code — Multi-Provider AI Coding CLI
LLxprt Code is an open-source AI coding CLI that switches across providers (Anthropic, Gemini, Codex, local). Install via brew or npm.
dingtalk-workspace-cli — Agent-Ready DingTalk CLI
dingtalk-workspace-cli (dws) is DingTalk’s open-source CLI for humans and AI agents, with OAuth login and `--dry-run` request previews.
Graphify — Repo Knowledge Graph + MCP
Graphify extracts docs/code into a knowledge graph and can install as an MCP/skill across Claude Code, Cursor, Codex, and Gemini CLI. Install via uv/pipx.
pbi-cli — Power BI Skills for Claude Code
pbi-cli is a Python CLI that installs Claude Code skills for Power BI models and PBIR reports. Get started with pipx + `skills install`.