Learn more about APIs at Generate
Check out a few APIs that you might not know about.
In the context of the web, you might already have thought about APIs in the form of services made available by third parties (to find out more, take a look at our guides to the best JavaScript APIs, HTML APIs and Google APIs).
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 has for some time been the JavaScript API used to send asynchronous requests to a server. This can allow you to, for example, retrieve data from the server and update a page without having to reload the full page. Its name is an anachronism since it works with JSON as well as XML. It’s likely to be superseded by the more recent Fetch API over time.
Get top Black Friday deals sent straight to your inbox: Sign up now!
We curate the best offers on creative kit and give our expert recommendations to save you time this Black Friday. Upgrade your setup for less with Creative Bloq.
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
This may seem like a cop-out, but it’s important to think about. Even core JavaScript functions do things like manipulate the DOM. Think of the document object as an entry point. This means while they may be defined in separate specifications, there’s little fundamental difference between the new APIs we’ll look at below and core JavaScript functions that have been around for years.
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 - 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
Want to see Henri in the flesh extolling the virtues of APIs? Get your ticket now
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1
Steven Jenkins is a freelance content creator who has worked in the creative industry for over 20 years. The web and design are in his blood. He started out as a web designer before becoming the editor of Web Designer magazine and later net magazine. Loud guitars, AFC Bournemouth, Photoshop, CSS, and trying to save the world take up the rest of this time.