Debugging a RESTful API

With your browser, you will only be able to perform GET requests on a specific API. The good tools will make your developments much simpler. There are lots of tools to test a RESTful API. I will just list the one I use and love.

A JSON formatting extension

Often, you will just test the GET method and your first reflex will be to copy the address into your browser to check the result. In that case, you have the possibility to get more than plain text with extensions such as JSON Formatter for Chrome or JSONView for Firefox.

A RESTful client in your browser

The browser is the natural tool for dealing with HTTP requests. However, using the address bar will rarely allow you to test your API in detail.

Postman is an extension for Chrome, and RESTClient is its Firefox counterpart. They both have similar features, such as creating and sharing collections of queries, modification of the headers, and handling authentication (basic, digest, and OAuth). At the time of writing, only RESTClient handles OAuth2.

httpie

httpie is a command line utility à la curl but oriented towards REST querying. It allows you to type commands such as this:

http PUT httpbin.org/put hello=world

It's a lot friendlier than this ugly version:

curl -i -X PUT httpbin.org/put -H Content-Type:application/json -d '{"hello": "world"}'
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset