httpie
Send HTTP requests
TLDR
Check updates for http
List installed http plugins
Install/upgrade/uninstall plugins
SYNOPSIS
http [flags] [method] URL [item [item]]
PARAMETERS
--auth USER:PASS
Authenticate as USER with PASS.
--form
Submit data as application/x-www-form-urlencoded.
--json
Submit data as application/json (default).
--verbose
Print the whole request and response exchange.
--output FILE
Save output to FILE instead of stdout.
--style STYLE
Output styling. STYLE can be 'solarized', 'monokai', etc.
METHOD
The HTTP method to be used (GET, POST, PUT, DELETE, PATCH, etc.). Defaults to GET if data is not being sent, and POST otherwise.
URL
The URL to request.
ITEM
Request items in the form key=value. Use =@/path/to/file to upload files.
DESCRIPTION
HTTPie is a command-line HTTP client designed for human interaction. It simplifies making HTTP requests by providing a user-friendly syntax and helpful output formatting.
Unlike curl
, which requires a complex set of command-line options, HTTPie offers a cleaner and more intuitive approach, especially for common tasks like sending JSON data and authenticating requests. It supports features like colorized output, JSON support by default, persistent sessions, file uploads, and HTTPS authentication.
HTTPie automatically formats the output for easy readability, making it a valuable tool for developers, testers, and anyone working with APIs. It streamlines the process of testing and interacting with web services from the terminal.
CAVEATS
HTTPie may not handle very large files as efficiently as specialized tools designed for file transfers. Also, it primarily focuses on HTTP and HTTPS protocols.
CONTENT TYPES
HTTPie automatically sets the Content-Type header based on the data being sent. For example, when sending data using the --json
flag, the Content-Type is set to application/json
, and when using the --form
flag, it is set to application/x-www-form-urlencoded
.
You can also explicitly set the Content-Type using the Header:Value
syntax.
HISTORY
HTTPie was created by Jakub Roztocil and is designed to be a more user-friendly alternative to curl for making HTTP requests. It gained popularity due to its intuitive syntax, JSON support, and colorized output, making it a favorite among developers and testers for interacting with APIs and web services.