APIs — that is, Application Programming Interfaces — play a bigger role in today’s economy than ever before. They allow us to share important data and expose practical business functionality between devices, applications, and individuals. And although we may not notice them, APIs really are everywhere, powering our lives from behind the scenes.
To help our new readers better understand what APIs do and how they work, we’ve compiled a list of five of the most relatable examples of API usage in our everyday lives. From logging-in with Facebook to paying with PayPal, there’s no doubt you’ll have seen these API integrations somewhere!
1. Weather Snippets
One common API usage example we come across on a daily basis is weather data. Rich weather snippets seem to be commonplace, found on all platforms, like Google Search, Apple’s Weather app, or even from your smart home device. For example, if you search “weather + [your city’s name]” on Google, you’ll see a dedicated box at the top of the search results (called a rich snippet) with the current weather conditions and forecast. As an example, here’s the search for “weather new york”.
Google isn’t in the business of weather data (yet!), so they source this information from a third party. They do so by means of an API, which sends them the latest weather details in a way that’s easy for them to reformat. As we’ve previously covered, there are many weather APIs that power this kind of functionality.
2. Log-in Using XYZ
Another prominent example of API usage is the “log-in using Facebook/Twitter/Google/Github” functionality you see on so many websites. It’s incredibly convenient, but have you ever wondered how it works?
Instead of actually logging-in to users’ social media accounts (which would pose a serious security concern), applications with this functionality leverage these platforms’ APIs to authenticate the user with each login. For example, here’s the Facebook Login API.
The way it works is pretty simple. Every time the application loads, it uses the API to check whether the user is already logged in by means of whatever social media platform. If not, when the user clicks the “Log-in Using XYZ” button, a pop-up opens where they are asked to confirm they actually want to log-in with that social media profile. When the user confirms, the API provides the application with identification information, so it knows who’s logging in.
3. Pay with PayPal
Ever used PayPal to pay for something, directly within an eCommerce store? Yep, that’s also an API at work. Just like with logging-in using a social media service, the “Pay with PayPal” functionality is built with APIs to ensure that the end application can only do what it needs to, without being exposed to sensitive data or gaining access to unintended permissions.
In terms of the inner-workings of this handy function, it’s very similar to the log-in process described above. When the user clicks the “Pay with PayPal” button, the application sends an “order” request to the PayPal API, specifying the amount owed and other important details. Then, a pop-up authenticates the user and confirms their purchase. Finally, if everything goes to plan, the API sends confirmation of payment back to the application.
4. Twitter Bots
Another example of APIs at work is the huge range of bots on Twitter. Twitter bots are accounts that automatically tweet (or retweet), follow, and send direct messages based on software instructions. There are loads of bots on Twitter, but here are just a few of our favorites:
- TinyCareBot: Sends hourly reminders to drink water, stretch, get fresh air, and more.
- Grammar Police: Identifies common grammar mistakes made by its followers.
- Netflix Bot: Tweets when new content is released on Netflix.
All of these bots are powered by the Twitter API. Aside from allowing you to execute simple actions — like Tweeting a certain phrase or following a user — the Twitter API can also tell bots when something specific happens on the platform. For example, you can ask the Twitter API to tell your bot whenever it receives a new follower. Then, you can program your bot to send a message to that follower using the API.
5. Travel Booking
Ever wondered how travel booking sites are able to aggregate thousands of flights and destinations and showcase the cheapest option? Often, the answer is by using third-party APIs to collect flight and hotel availabilities from providers. Likewise, if you make a booking through one of these services, they’ll use APIs to confirm the trip with the provider they sourced it from.
APIs are great for travel services since they make it easy for machines to quickly and autonomously exchange both data and requests — in this case, trip availabilities and reservation requests. Without using APIs, an employee of the booking service would have to manually email the airline or hotel to find out their availability. Then, after an email comes back from the provider, they’d have to confirm it with the traveler. By the time the travel broker sends yet another email back to the provider, confirming the trip, it’d probably no longer be available!
Behind the Scenes with APIs
So far, this article has discussed five everyday examples of API usage. However, it’s important to recognize that APIs are used behind the scenes for a whole lot more than those examples could ever illustrate! This is especially true in corporate sectors, where effectively storing and exchanging data is paramount to everyday operation.
Here are just some of the ways APIs power our lives from behind the scenes:
- Financial institutions like banks use private APIs to track and manage checking accounts, credit cards, and more.
- Retail giants use APIs to communicate with courier networks, ensuring packages are picked up as soon as possible and tracking them as they are moved.
- Web applications use APIs to connect user-facing front ends with all-important back end functionality and data.
- Streaming services like Spotify and Netflix use APIs to distribute content.
- Automotive companies like Tesla send software updates via APIs. Others use APIs to unlock car data for third-parties.
APIs are everywhere, and it only takes picking up your smartphone to see them in action. Whether it’s searching for the weather on Google, logging-in with Facebook, paying with PayPal, or interacting with a Twitter bot, all of these things are powered by APIs. To boot, there’s a lot more going on with APIs behind the scenes. We may not see them as much, but they’re integral to our daily digital lives.