In Computer Science, API is an acronym for "Application Programming Interface".
Done. Just kidding.
That doesn't tell you anything. In fact, that makes it sound even more complicated that what it actually is. An API is what we use for our web application to communicate with our server/back-end. It comprises of a bunch of routes and protocols.
To further understand how an API works, we must understand what HTTP Requests and Responses are.
So, what is HTTP?
HTTP stands for "Hyper Text Transfer Protocol". This is a data transfer protocol we use on the internet. This is how we send and receive data. You can consider this the middle man, or the messenger. If you are sending data to a server, you need that data carried over. That is where HTTP comes in.
When you make a request to the server, that data is sent across the network and the server receives that request. After receiving it, the server will process it and send back a response. If this response is successful, it will return a HTTP status of 200. If it is not successful however, it can throw a 400, or 500 status.
Another example to explain an API would be a restaurant.
The dining area would be the client or the web page itself. This is where you sit down, see the menu, eat, etc.
The waiter/waitress would be the API and asks you what you would like. This is where you "send that request", or tell that waiter/waitress what you want. Then, that waiter/waitress will take your order to the kitchen.
The chefs and the kitchen would be considered as the server. You don't see the magic happening, but when your food is ready, the "server" or the chef will give that food that you requested to the waiter/waitress. Then, they will deliver that food for you.