Awesome http clients you can use to build or use RESTFul APIs

RESTFul APIs are taking over the web. In fact creating APIs is the way that we develop applications now days. That's because RESTFul APIs enable you to quickly build multi-platform apps for your own internal systems or for third parties.

Am currently working on a project at my work place that involves building an API. I've ditched XML for RESTFul APIs. This allows me to build the User interface in PHP while the back-end is in Python one of my favorite languages.

But to create a RESTFul APIs you should have an http client. This will enable you to test out your or other APIs on the internet before you incorporate it on in your own app. There are quiet a number of http clients in the wild, but I use mainly Unix/Linux as my local development environment. This ofcourse dedicates my choice of tools.

Curl

Curl needs no introduction if you use Unix-like operating systems. It's a great command-line tool you can use to send http requests to RESTFul API. If you know how to use it, it can really work wonders especially for system's guys who use the command line or bash a lot like me.

Sending a GET http request is as simple as

curl http://localhost/api

You can also send a POST request which expects a json response like

curl -i -H "Content-Type: application/json" -X POST http://localhost/api

But it gets a bit messy if you have a long string with spaces in it. You have to encode the data before you send it over the wire and you can use the following command;

curl -G "http://localhost/api?param1=val1&param2&val2" --data-urlencode "message=${msg}"

Curl is great, but isn't for humans. This is where Httpie comes in. If you don't have curl installed, then you can try wget, the old man himself but you probably have to develop a beard first :)

Httpie

Httpie is really awesome. I fell in love with it the very first time I used. It's a command-line tool just like curl, but allows you make http request in human readable format.

You can send a GET request like so
http GET http://localhost/api?param1=val1&param2=val2

You can do a post request with Httpie like so.The -v option is for verbose while -f tells Httpie you are sending form data.

http -vf POST http://localhost/api \ param1=val1 \ param2=val2

Httpie will show you request headers as well as the response with some added salt of syntax highlighting.

Postman

I just got to learn about Postman today. Here we are crossing over the GUI http clients. Postman has a Mac and Chrome client for you to make http requests. Apparently Linux app is coming soon which I can't wait to install.

I quickly installed the chrome extension and started making http requests to my API. You can signup for an account so that you data is store on the cloud.

Insomnia

Like Postman, I got to learn about this today as well. Insomnia is a cross-platform http client with clients for Mac, Windows and Linux. I downloaded a client for Ubuntu 14.04 LTS which is the machine I use for my work.

It's very straightforward and intuitive. You can also save your http requests so you don't to enter the same thing over and over again.

So those are four awesome http clients you can use for build a RESTFul API for your own blog or for your companies application so that over developers can interact with your system.

Feature Image: wikimedia.org/

David Okwii

David Okwii is a Ugandan-based Technology writer and System's Engineer.

Kampala Uganda http://www.davidokwii.com

Subscribe to oquidave@geek:~ #

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!