HTTPie Cheat Sheet

A cheat sheet in English by clucinvt

HTTPie—aitch-tee-tee-pie—is a command line HTTP client with an intuitive UI, JSON support, syntax highlighting, wget-like downloads, plugins, and more.

13,752 views 2,479 downloads 30 Mar 2018 History
3.7 avg · 0 ratings

Cheatsheet version

Version
1.0.2
Last update
2/15/2018
HTTPie version
0.9.8

Instal­lation

Get the installer at httpie.org

Basic usage

GET
http localh­ost­:8080
GET
Help
http --help
POST form
http -f POST localh­ost­:8080 name=value
POST json
http POST localh­ost­:8080 name=value
POST json
http -j POST localh­ost­:8080 name=value
POST json
http POST localh­ost­:8080 < data.json
PUT
similar to POST
DELETE
similar to GET
Display request & response (verbose)
http -v localh­ost­:8080
Download
http localh­ost­:80­80/file > file
Download wget style
http -d localh­ost­:80­80/file
Upload
http localh­ost­:8080 < file

HTTP request headers

Set headers
http localh­ost­:8080 User-A­gen­t:B­aco­n/1.0 '­Coo­kie­:va­lue­d-v­isi­tor­=ye­s;f­oo=­bar­' X-Foo:Bar Refere­r:h­ttp­://­htt­pie.org/
Default HTTPie request headers
GET / HTTP/1.1
Accept: /
Accept­-En­coding: gzip, deflate
User-A­gent: HTTPie/<version>
Host: <ta­ken­-fr­om-­URL>
List of headers
Common request headers
Host, User-A­gent, Accept, Accept­-La­nguage, Accept­-En­coding, Accept­-Ch­arset, Keep-A­live, Pragma, Cache-­Con­trol, Cookie, Conten­t-Type, Conten­t-L­ength

Authen­tic­ation

Basic auth
http -a userna­me:­pas­sword POST localh­ost­:8080
Basic auth (pw prompt)
http -a username POST localh­ost­:8080
Basic auth (empty pw)
http -a username: POST localh­ost­:8080
Digest auth
http -A digest -a userna­me:­pas­sword POST localh­ost­:8080
Auth plugins
OAuth, SPNEGO, NTLM, JWT, more

Badges

Nice Cheat Sheet

Comments (1)

FluxSauce 20:01 30 Mar 2018

Nice! You should include the shortcut for localhost, so instead of localhost:8000 you can just type :8000

Reply

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.