An Application Programming Interface (API) is a set of abstractions that makes complex programming tasks easier. This might be a browser API that provides deeper access to the browser and its surrounding environment. It could also be a third-party API that lets you access data from another service in your own application.
- Browser APIs
- Third-party APIs
- More information
Browser APIs provide deeper access to the browser and its surrounding environment. There are many, but here is a few of the most common.
The Document Object Model
- Selected an element on the page
- Added a class to an element
- Written code that responds to user input (events)
Then you've worked with the DOM.
Learn more: What is the DOM?
The Fetch API
The Fetch API provides functionality for fetching data across the network. For example, you might use it to fetch data from an external JSON file. You could then use this data in your application. The
XMLHttpRequest interface is older, but it provides similar functionality.
The Web Storage API
Before the Web Storage API, there were only cookies. Nowadays, developers are increasingly using
sessionStorage to manage data in their applications. The Web Storage API is powerful and easier to work with than cookies.
Third-party APIs let you access data from another service in your own application. There could be an infinite number of these, but here are some popular services.
The Twitter Developer Platform
The Twitter Developer Platform provides a suite of APIs that let you access Twitter data programmatically. For example, you can use Twitter for Websites to display a live feed of Tweets on your website.
The Google Maps Platform
The New York Times Developer Network
The New York Times Developer Network is a set of APIs that allow you to use data from The New York Times in your own application. For example, you can use the Top Stories API to create a live feed of articles from The New York Times.
For more information, check out the introduction to web APIs in the MDN Web Docs. It was a really helpful resource when writing this post.
My friend Chris Ferdinandi also wrote a guide called APIs and Asynchronous JS which should be helpful.