Installation
# Make sure we have an up-to-date version of pip and setuptools:
pip install --upgrade pip setuptools
pip install --upgrade httpie
Configuration
Config file location:
~/.httpie/config.json Windows: %APPDATA%\httpie\config.json
For example:
"default_options": ["--ignore-stdin", "--pretty=all"]
The config directory location can be changed by setting the HTTPIE_CONFIG_DIR environment variable. To view the exact location run http --debug
.
Commandline
# Set a header with space:
# http://alblue.bandlem.com/2012/03/httpie.html
http GET alblue.bandlem.com "If-Modified-Since: Thu, 08 Mar 2012 17:30:07 GMT"
http example.org hello=world # => POST
http :3000 # => http://localhost:3000
http :/foo # => http://localhost/foo
# ':' HTTP headers:
# Referer:http://httpie.org Cookie:foo=bar User-Agent:bacon/1.0
# '==' URL parameters to be appended to the request URI:
# search==httpie
# '=' Data fields to be serialized into a JSON object (with --json, -j) or form data (with --form, -f):
# name=HTTPie language=Python description='CLI HTTP client'
#':=' Non-string JSON data fields (only with --json, -j):
# awesome:=true amount:=42 colors:='["red", "green", "blue"]'
# '@' Form file fields (only with --form, -f):
# [email protected]~/Documents/CV.pdf
# '[email protected]' A data field like '=', but takes a file path and embeds its content:
# [email protected]/essay.txt
# ':[email protected]' A raw JSON field like ':=', but takes a file path and embeds its content:
# package:[email protected]/package.json
# You can use a backslash to escape a colliding separator in the field name:
# field-name-with\:colon=value