Resources
Videos
- Intro tutorial
FAQ
Simple GET example
http DOMAIN/PATHUse HTTPS
https DOMAIN/PATHlocalhost is the default domain
http :8000 # GET http://localhost:8000Using other methods
http POST :8000 # or PUT, PATCH, etc.Simple JSON POST
http :8000 color=red food=pizzaThe above POSTs a simple object to http://localhost:8000/:
{
"color": "red",
"food": "pizza"
}The POST method was emitted, as it is the default when providing payload variable(s).
Note: The whitespace in the JSON above is for readability, HTTPie would not usually include unnecessary spaces or line breaks.
JSON property that is not a string
http ... age:=44 learning:=true name=ClausThe above sends this object:
{
"age": 44,
"learning": true,
"name": "Claus"
}Show request (headers/body)
http -v ...Query parameters
http ... param1==2 param2==5 # ...?param1=2¶m2=5Dry-run (show request that would be sent)
http --offline ...Set request header
http ... X-My-Custom-Header:my-valuePOST form data (application/x-www-form-urlencoded)
http -f ... param1=value param2="another value"...
# or
http --form ... param1=value param2="another value" ...Basic auth
http -a USERNAME:PASSWORD ...Remove default User-Agent header
http ... User-Agent: ...Build a more complex JSON object
http ... category=tools search[type]=id search[id]:=1…results in this object being sent:
{
"category": "tools",
"search": {
"id": 1,
"type": "id"
}
}Append to a JSON array
http ... \
search[keywords][]=APIs \
search[keywords][]=CLI…results in this object being sent:
{
"search": {
"keywords": [
"APIs",
"CLI"
]
}
}Send a JSON array
Omit the key:
http ... []:=1 []:=2…results in this array being sent:
[
1,
2
]Escape character
\ escapes [, ] and \
Send file contents as raw request body
http ... < data/file.jsonUpload a file using multipart/form-data
http --form ... application@/home/claus/Desktop/resume.pdfUse Bearer authorization
http -A bearer -a TOKEN ...Note: despite bearer requiring a lowercase b in the -A argument, the sent header will bear a capitalized Bearer.
Follow redirects (Location response header)
http --follow ...Do not verify host certificate (insecure)
https --verify=no ...Output only response
http -b ...
# or
http --body ...Send clipboard (macOS)
pbpaste | http ...