Here’s a cheat sheet for HTTPie, a command-line HTTP client:
Basic HTTP Requests
GET Request:
http GET http://example.com
POST Request:
http POST http://example.com/resource name=value
PUT Request:
http PUT http://example.com/resource id=123 name=value
DELETE Request:
http DELETE http://example.com/resource/123
Request Headers
Specify Headers:
http GET http://example.com User-Agent:MyApp Authorization:"Bearer Token"
Add JSON Content:
http POST http://example.com Content-Type:application/json name=value
Request Data
Form Data:
http -f POST http://example.com name=value
JSON Data:
http POST http://example.com Content-Type:application/json name=value
Authentication
Basic Auth:
http --auth username:password GET http://example.com
Bearer Token:
http GET http://example.com Authorization:"Bearer Token"
Response Information
Show Response Headers:
http -h GET http://example.com
Show Response Body:
http -b GET http://example.com
Request Timeout
Set Timeout:
http --timeout=5 GET http://example.com
Session and Cookies
Save Cookies:
http --session=session.json --follow GET http://example.com
Load Cookies:
http --session-read-only=session.json GET http://example.com
Redirects
Follow Redirects:
http --follow GET http://example.com
Other Options
Print Curl Command:
http --print=H GET http://example.com
Output to File:
http GET http://example.com > output.txt
This HTTPie cheat sheet covers some common use cases. For more detailed information and options, refer to the HTTPie documentation.