tldr/pages/linux/httpie.md

37 lines
897 B
Markdown
Raw Normal View History

2017-12-20 03:51:32 +00:00
# httpie
> A user friendly command-line HTTP tool.
> More information: <https://github.com/httpie/httpie>.
2017-12-20 03:51:32 +00:00
2017-12-20 12:27:08 +00:00
- Send a GET request (default method with no request data):
2017-12-20 03:51:32 +00:00
`http {{https://example.com}}`
2017-12-20 03:51:32 +00:00
2017-12-20 12:27:08 +00:00
- Send a POST request (default method with request data):
2017-12-20 03:51:32 +00:00
`http {{https://example.com}} {{hello=World}}`
2017-12-20 03:51:32 +00:00
2017-12-20 12:27:08 +00:00
- Send a POST request with redirected input:
2017-12-20 03:51:32 +00:00
`http {{https://example.com}} < {{file.json}}`
2017-12-20 03:51:32 +00:00
- Send a PUT request with a given JSON body:
2017-12-20 03:51:32 +00:00
`http PUT {{https://example.com/todos/7}} {{hello=world}}`
2017-12-20 03:51:32 +00:00
- Send a DELETE request with a given request header:
2017-12-20 03:51:32 +00:00
`http DELETE {{https://example.com/todos/7}} {{API-Key:foo}}`
2017-12-20 03:51:32 +00:00
2017-12-20 12:27:08 +00:00
- Show the whole HTTP exchange (both request and response):
2017-12-20 03:51:32 +00:00
`http -v {{https://example.com}}`
2017-12-20 03:51:32 +00:00
2017-12-20 12:27:08 +00:00
- Download a file:
2017-12-20 03:51:32 +00:00
`http --download {{https://example.com}}`
2022-02-17 10:46:07 +00:00
- Follow redirects and show intermediary requests and responses:
`http --follow --all {{https://example.com}}`