APIs and API/REST Clients

An API is essentially a programmatic way for you to interact with a system. When online services provide an API it can allow for a huge opportunity of customisation and extendability.

  • Practically all social media tools like Buffer, Sprout Social, Hootsuite would be utilising APIs provided by Facebook, Twitter, Instagram, etc in order to build their app.
  • Features of these apps would be limited to what the API allows: this is why you probably don’t see any Google+ integration as Google hasn’t release any API that lets you post updates!

But whenever starting to play with an API you’d probably start looking at the docs to understand how to make calls or if they have any sample code/libraries to get you going. Sometimes setting up a test environment can be time consuming so this is where raw API requests that utilise cURL are great! You can run the requests straight from the command line: see an example below from Intercom’s API to list users

curl https://api.intercom.io/users \
-H 'Authorization:Bearer <Your access token>' \
-H 'Accept: application/json'

I started off using cURL but after a while I needed something that

  • was less prone to breakage (e.g. missing out a \ or a ' causing malformed/incorrect requests)
  • was easy to switch between different requests
  • provided extra features for extensibility (e.g. if I wanted to switch access tokens to connect to a different environment, I would have to change the request to use the correct token)

Meeting Postman

That is when I met Postman. Their tagline of “Postman Makes API Development Simple.” did certainly ring true to me.

Postman annotated.png

Postman provided

  • Folders for categorisation of requests
  • Different environments and variables: so that I can quickly switch credentials between different development/test/production environments
  • Multiple tabs: enabled me to make a request in one tab and switch to the next tab to see any related changes

The came Insomnia (of the good kind)

After a while, I got a bit tiresome of seeing Postman’s loading/splash screen and it felt like it took quite long to start up. While it has so many features (such as being able to use it for testing), I didn’t really need all of them so I was on the look out for something simpler and quicker.

Then I found Insomnia with its lovely https://insomnia.rest/ URL

Insomnia Annotated.png

It has almost all the features I need and is even open source! My two main issues are

  • No tabs: so switching between requests can be a bit tiresome but workable (I still utilise Postman when I do need to do more efficient switches)
  • It auto saves requests: I have a template request which I modify and it automatically saves it: so that means my template is gone and I could have lost documentation on how to make the request and thus relying on going back to the API docs to find the full details. Postman only saves the template request when you actually request to save it. Perhaps since Insomnia is open source I could bring this up as a feature request or even implement it myself
Postman Template.png
Postman with my request template
Insomnia Template Gone.png
Insomnia with my request template overridden by last request

Insomnia & Postman

  • Free
  • Cross platform (Windows/Mac/Linux)
  • Folders for categorisation
  • Environment variables and switching
  • Import/Export function
  • Keyboard shortcuts
  • Online account/sync option
  • Proxy Support
  • Themes

Insomnia

  • Pros
    • Cleaner interface
    • Quicker startup
    • Open source
  • Cons
    • No tabs
    • Requests auto save
    • Online sync requires a paid subscription

Postman

  • Pros
    • Multiple Tabs
    • Requests do not auto save
    • Free online sync
    • More features
  • Cons
    • Slower startup
    • Cluttered interface

API/REST clients such as Postman and Insomnia will definitely be something I’ll keep in my toolkit and it has helped me so many times from being able to debug Firebase Cloud Messaging, TelegramSlack and more

So the next time you find yourself looking into APIs, perhaps look for a Postman collection to see if that can help you get things started up and running quicker

Advertisements