Invoke Your REST APIs with HTTPie

HTTPie is a command-line HTTP client for interacting with HTTP servers.

Somnath Musib
Nov 22, 2019 · 5 min read
Photo Unsplash by Reginar

Overview


Features


Installing HTTPie

brew install httpie
apt-get install httpie
pip install --upgrade pip setuptools

pip install --upgrade httpie
easy_install httpie

Using HTTPie

Invoking the http command

Using the HTTP command

Getting Data

http GET http://httpbin.org/get
http https://jsonplaceholder.typicode.com/posts userId==1
http https://jsonplaceholder.typicode.com/posts userId==1 id==1
http example.org X-Foo:Bar Sample:Value 

Posting and Updating Data

http POST https://jsonplaceholder.typicode.com/posts title=foo body=bar userId:=9
Creating data in Server
http PUT https://jsonplaceholder.typicode.com/posts/10002 data=@data.txt

Deleting Data

http DELETE https://jsonplaceholder.typicode.com/posts/1

Authentication with HTTPie

Accessing resources using Basic authentication

Failed Basic Authentication with HTTPie
Successful Basic Authentication with HTTPie

Accessing resources using Digest authentication

Successful Digest Authentication with HTTPie

Wrapping Up


The Startup

Medium's largest active publication, followed by +563K people. Follow to join our community.

Somnath Musib

Written by

Full Stack Developer ★ Author @ Udemy and Medium

The Startup

Medium's largest active publication, followed by +563K people. Follow to join our community.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade