HTTPie – a CLI, cURL-like tool for humans

Sponsored Link
HTTPie is a command line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible. It provides a simple http command that allows for sending arbitrary HTTP requests using a simple and natural syntax, and displays colorized output. HTTPie can be used for testing, debugging, and generally interacting with HTTP servers.

HTTPie Features

Expressive and intuitive syntax
Formatted and colorized terminal output
Built-in JSON support
Forms and file uploads
HTTPS, proxies, and authentication
Arbitrary request data
Custom headers
Persistent sessions
Wget-like downloads
Python 2.6, 2.7 and 3.x support
Linux, Mac OS X and Windows support
Plugins
Documentation
Test coverage

Install HTTPie on ubuntu

Open the terminal and run the following command

sudo apt-get install httpie

Using HTTPie

http [flags] [METHOD] URL [ITEM [ITEM]]

Positional arguments:

METHOD -- HTTP method to be used for the request (GET, POST, PUT, DELETE,PATCH, ...).

URL -- Protocol defaults to http:// if the URL does not include it.

items -- HTTP header (key:value), data field (key=value) or raw JSON field (field:=value).

HTTPie Examples

Custom HTTP method, HTTP headers and JSON data:

$ http PUT example.org X-API-Token:123 name=John

Submitting forms:

$ http -f POST example.org hello=World

See the request that is being sent using one of the output options:

$ http -v example.org

Upload a file using redirected input:

$ http example.org < file.json Download a file and save it via redirected output: $ http example.org/file > file

Download a file wget style:

$ http --download example.org/file

Use named sessions to make certain aspects or the communication persistent between requests to the same host:

$ http --session=logged-in -a username:password httpbin.org/get API-Key:123

$ http --session=logged-in httpbin.org/headers

For more examples check here

Sponsored Link

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *