menu

What are Web APIs

API or web API is a concept and not a technology. Web API as the name suggests, is an form of API over the web which can be accessed using HTTP protocol.

What are APIs?

Application Programming Interfaces (APIs) are constructs made available in programming languages to allow developers to create complex functionality more easily. They abstract more complex code away from you, providing some easier syntax to use in its place.

JavaScript, in particular, has many APIs available to it — these are not part of the JavaScript language itself, rather they are built on top of the core JavaScript language, providing you with extra superpowers to use in your JavaScript code. They generally fall into two categories:

  • Browser APIs are built into your web browser and are able to expose data from the browser and surrounding computer environment and do useful complex things with it. For example, the Web Audio API provides JavaScript constructs for manipulating audio in the browser — taking an audio track, altering its volume, applying effects to it, etc. In the background, the browser is actually using some complex lower-level code (e.g. C++ or Rust) to do the actual audio processing. But again, this complexity is abstracted away from you by the API.

  • Third-party APIs are not built into the browser by default, and you generally have to retrieve their code and information from somewhere on the Web. For example, the Twitter API allows you to do things like displaying your latest tweets on your website. It provides a special set of constructs you can use to query the Twitter service and return specific information.

What can APIs do?

There are a huge number of APIs available in modern browsers that allow you to do a wide variety of things in your code. Example:

  • APIs for manipulating documents or DOM
  • APIs that fetch data from the server
  • APIs for drawing and manipulating graphics
  • Client-side storage APIs

Common third-party APIs

  • Twitter API
  • Google Maps API
  • Facebook suite of APIs
  • YouTube API
  • Pinterest API
  • Twilio API

Reference: Client side web APIs