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
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 X-API-Token:123 name=John

Submitting forms:

$ http -f POST hello=World

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

$ http -v

Upload a file using redirected input:

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

Download a file wget style:

$ http --download

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

$ http --session=logged-in -a username:password API-Key:123

$ http --session=logged-in

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 *