Thursday, May 6, 2021

The Value of Web APIs

The terms “Web API” and “”API-first development” have been gaining a lot of traction in recent months. Yet, the term API – or Application Programming Interface – is quite vague and may apply to a variety of application development components. At its most general, it’s a set of function/routines, protocols, and tools for building software applications. With regards to its role in Web development, the primary focus is on a piece of code that allows two software programs to communicate with each other. More specifically, the API defines the correct way for a developer’s code to requests services from a vendor’s service provider component. The vendor describes the required syntax in their public documentation and may even provide tools that generate the code for you. In today’s article, we’ll explore some of the ramifications and benefits that API-driven development offers the provider, user, and of course, you, the developer.

Examples of Popular APIs

With over 15,000 APIs available, ProgrammableWeb is the place to find an API for a multitude of tasks. Some of the most requested APIs to be found there are offered by big players like Google Maps, Flickr, Twitter, Amazon, and Youtube. Speaking of the latter, I described a couple of Youtube APIs in my There’s More than One Way to Play Embedded YouTube Videos! article. Youtube provides a couple of different APIs: an HTML markup iFrame API for basic embedding and the IFrame Player API, which uses JavaScript to provide more granular control over video playback.

Other APIs may utilize both HTML, such as elements with a given attribute or handlebars ({}) and JavaScript. One such API is the Geobytes Ajax Autocomplete Cities List API. It employs JSONP to fetch a list of matching cities based on the first typed letters. Matches are then displayed beneath the textbox. Here are the client-side scripts and HTML that invoke the API:

//in the head:
<script src="" type="text/javascript"></script>
<script src=""></script>
<script type="text/javascript">
 jQuery(function ()
  source: function (request, response) {
         function (data) {
  minLength: 3,
  select: function (event, ui) {
    var selectedObj = ui.item;
    return false;
  jQuery("#f_elem_city").autocomplete("option", "delay", 100);

//somewhere in the body:
<input class="ff_elem ui-autocomplete-input" type="text" name="ff_nm_from[]" value="" id="f_elem_city" autocomplete="off">


Benefits of Web APIs

Much like Object-oriented programming (OOP) did a few decades ago, APIs encourage modularity, separation of concerns, and the hiding of internal complexities. OOP has shown us that modular code is easier to test, maintain and update. It’s the ultimate in black box programming. All you need to concern yourself with is the API for using a particular library. Once you’ve got that down, it should just work! Moreover, as long as the API remains intact, individual components can be swapped in and out without any ill effects.

The target audience of Web APIs are usually developers or web-savvy Do-it-yourselfers, whomever is incorporating a service into a web page. Having said that, end users and the API providers also reap the many rewards of an API. Here’s how each of these groups benefit in their own way:

  • Web Developers: Web APIs save developers from having to code advanced functionality and features whose subject matter they may have little knowledge about, for instance geocoding, charting, weather forecasting, probability analysis, etc… APIs tend to offer the opportunity for greater customization and flexibility than standard widget components. APIs also benefit developers by:
    • enriching functionality: features which are not available on a device or provided by an operating system can be invoked via Web APIs
    • combing multiple services: completely new operations can be designed by mixing and matching several APIs
    • integrating more quickly and easily: API technologies make registration and integration much easier for developers, compared to more outdated approaches (like downloading widgets and kits)
  • End Users: Incorporating one or more good Web APIs into one’s website can greatly increase its usefulness, enhance interactivity, and just make it more interesting in general.
  • API Providers: Adoption by the web development community can supply the API provider with invaluable advertising by:
    • building brand loyalty
    • spreading the word about the company’s products and services
    • increasing website traffic
    • providing useful tools to consumers
    • conveying company ideas and messaging

    Not to mention, the API itself can become a money maker if the provider charges for the API or for an advanced version of it.


Web APIs have been catching on so well that there is an emerging trend in web development called “API-first” approach, in which the underlying API(s) is/are selected or built before UI components. This strategy makes perfect sense when you consider that both websites and mobile apps will need to interact with the same processes and data. This is not to say that this approach is always the superior one, but if you do decide to integrate a third party API, make sure that it works properly, is easy to integrate, and fits the user’s needs. Once you’ve become adept at working with APIs, you may even consider taking advantage of the booming API market and get into developing APIs yourself.

Rob Gravelle

Rob Gravelle resides in Ottawa, Canada, and is the founder of Rob has built systems for Intelligence-related organizations such as Canada Border Services, CSIS as well as for numerous commercial businesses.

In his spare time, Rob has become an accomplished guitar player, and has released several CDs. His band, Ivory Knight, was rated as one of Canada’s top hard rock and metal groups by Brave Words magazine (issue #92) and reached the #1 spot in the National Heavy Metal charts on Reverb Nation.

Popular Articles