Google, for example, exposes a Google Maps API that you can consume as a developer to integrate Google’s mapping, street view, navigation and more into your app. This involves importing scripts hosted on Google servers, then using objects and functions from those scripts in line with the API documentation, which it provides. APIs like this are generally what we’d refer to as “server-side APIs”.
However, what you might never have considered is that the basic JS functionality built into the browser is also composed of a set of APIs, which are constantly being updated. These “client-side APIs” provide many of the basic features taken for granted within JS, such as manipulating the DOM, embedding graphics/sound, or interfacing with the device you’re running on.
More likely than not you’ll have read documentation for many of them online when building a site/app. These APIs are typically based on a single specification which ensures that all browser makers implement the functionality consistently, thus ensuring that your code works across any browser.
APIs in common use today
XMLHTTPRequest (opens in new tab)
Web Sockets (opens in new tab)
Web sockets enable a two-way communication session to be opened between a browser and server. This enables the server to provide updates to the user without the browser needing to poll the server at an interval. Web sockets are in use on a number of sites today; on Stack Overflow they’re used to feed live notifications of responses to questions.
DOM functions (opens in new tab)
Want to know more about APIs?
Henri HELLvetica is a man in the know. He is a freelance developer who has turned his interests to a potpourri of performance engineering with pinches of user experience.
His talk at Generate New York from 25-27 April 2018 (opens in new tab) - Planet Of The APIs: A Tale Of Performance & User Experience – peruses present-day and even experimental practices employed in measuring web apps, and providing performant user experiences. You can find him tweeting at @HenriHelvetica (opens in new tab)
Want to see Henri in the flesh extolling the virtues of APIs? Get your ticket now (opens in new tab)