DEV Community

Cover image for What is an API?
Gabrielle Davidson
Gabrielle Davidson

Posted on • Edited on

What is an API?

API, or Application Programming Interface, is one of the many acronyms thrown around in the programming world. It took me months to grasp the concept, not least because APIs can look very different from each other, depending on what they are trying to accomplish.

The best, high-level conceptualization I've come up with that encapsulates them all is that APIs are a simplified way to interact with complex information. That still sounds kind of vague. Let's look at some examples.

Real world

The picture in the header of this article shows an old radio. We can actually think of this radio, with its three dials, as an API for transforming radio waves into sound and having some control over them.

We don't have a way to directly access radio waves without a radio. Nor would we probably want to, that's a lot of complex information to handle. So, someone devised this simple interface that gives us the ability to switch between different frequencies, control the volume, and turn the radio off and on.

There is a lot more you could do with radio waves that has nothing to do with listening to music, but we don't need to be bogged down with all that stuff. The radio API just gives us what we need.

Programming world

Similarly, in the programming world, we frequently want to easily incorporate data from other complex sources to make our projects more dynamic and useful.

Let's say I'm making a weather app. How do I get the weather data to display on my home screen? Do I have to collect and maintain it all myself? Lucky for me, someone else has already done that and created an API that allows me to access and use that data. It doesn't have physical dials but there are instructions on how to use it and it only gives me what I need, not the hoards of information that come with monitoring the weather, just like the radio.

This is great news! Not only do I not have to collect my own data, I also don't have to spend an inordinate amount of time sifting through someone else's data. This saves me a lot of time.

It also allows the creator of the API to let other people use some of their data while keeping some private. This might be like how Pinterest provides an API for your website to use its icon to save something to a board without having to give you all of its user or proprietary information. You get to give your users the ability to harness the power of Pinterest and Pinterest gets to reach more people. It's a win-win for everyone!

The wonderful world of APIs

APIs are everywhere and there are all kinds. There is a Star Wars API and a number facts API. Large companies like Facebook have APIs. Here is a collection of a bunch of other APIs. Whatever you're looking for, there is probably an API for it. You'll need to understand server requests and asynchronous javascript in order to fully work with them but hopefully this gives you a better understanding of what they even are. And once you get used to them, they are a lot of fun!

Top comments (0)