The simple answer is that using an API enables you to access publicly available data(which is a lot). Your able to access it by sending a request for information to a server and then getting a response with the requested information. Once you receive that data, you're able to work on it.
The long answer? Here we go.
An API is the abbreviation for an Application Programming Interface. It is enables two computers to speak with each other using special protocols. Adding an API to your project allows your computer to communicate with another computer asking for information or retrieving information from the other computer.
I know, I know...a lot of jargon but just hold on....let's break it down:
It is enables two computers to speak with each other using special protocols
To put it simply, this means that two computers(the one you are working/coding on right now and the one storing the information you want) have to have an in-between in order to speak with each other(get information and send requests).
The protocols being spoken about are the sending protocols and the getting protocols(we'll talk about this in another article).
Adding an API to your project allows your computer to communicate with another computer asking for information or retrieving information from the other computer.
As I mentioned, the information you want to use in your computer might be a lot and I mean A LOT. For example, think about the number of restaurants in your country. Do you have that data? Can you get that data by counting all those restaurants? Probably not. This is where the other computer comes in(the information-holder). Someone somewhere already compiled all the restaurants in your country(and beyond) and continues to record that information as the restaurants are open or are closed down. For you to have access to those restaurants, you need to find a way to access the information from the information-holder. An API will ask(request) the information from the information holder and return(retrieve) to you the data that has been found.
I really liked this bee analogy which helped me in understanding what was going on with APIs

I know that learning about APIs can be daunting as it was for me when I first came across it. I was at first confident that it was almost too easy to learn(I mean it's just a URL right?) but then reality hit me when I actually needed the data and all I was getting was errors. So I had to go back to the drawing board to understand why exactly do I need this? Is it useful? and most importantly can I teach it to someone else?(psst...look up the Feynman Technique)
Top comments (0)