httpie is a command-line tool for making HTTP requests. It is designed to be user-friendly and intuitive, making it easy for developers to make and debug HTTP requests from the command line. httpie is built on top of the popular Python library requests and provides features such as syntax highlighting, JSON and form data support, and a built-in help system.
httpie allows you to send HTTP requests using the standard verbs such as GET, POST, PUT, DELETE, etc. and provides many options to customize the requests. httpie also provides features such as syntax highlighting for JSON and XML responses, automatic decompression of gzip and deflate encoded responses, and support for multipart file uploads. It also supports the use of environment variables and custom configuration files, to keep sensitive information like api keys, secrets etc.
httpie also has a built-in help system that allows you to see the available options and usage examples for each command. It’s worth noting that httpie is not the only tool for sending HTTP requests from the command line, other similar tools like curl, http-prompt etc. But httpie stands out for its user-friendly interface, and the additional features it provides, it’s very popular among developers because of its simplicity and ease of use.
httpie Command Examples
1. Send a GET request (default method with no request data):
# http https://example.com
2. Send a POST request (default method with request data):
# http https://example.com hello=World
3. Send a POST request with redirected input:
# http https://example.com < file.json
4. Send a PUT request with a given JSON body:
# http PUT https://example.com/todos/7 hello=world
5. Send a DELETE request with a given request header:
# http DELETE https://example.com/todos/7 API-Key:foo
6. Show the whole HTTP exchange (both request and response):
# http -v https://example.com
7. Download a file:
# http --download https://example.com
8. Follow redirects and show intermediary requests and responses:
# http --follow --all https://example.com