I hear this question a lot. Well, actually, I hear people using this term incorrectly a lot and so I’m asking the question for them here. I apologize in advance to my engineering colleagues who may have justifiable grievances with my oversimplified analogy but I’m targeting a non-technical audience for this post.
To understand an API, first think of yourself as owning a restaurant. You offer guests (random visitors without any documentation of identity) a good meal. To provide that meal you have ingredients stocked in the pantry, refrigerators, freezers, etc. and you have a bunch of tools, equipment and supplies to cook and serve the meal.
Now, when guests arrive do you invite them back to the kitchen to see your ingredients and make for themselves any meal they wish? Of course not. And why not? As you probably already know, doing so would mean every request is likely a unique process that is not easily repeatable, there’s no guarantee a guest knows how to assemble ingredients into a tasty combination and your operations might be irreparably damaged because of guests mucking with equipment or exhausting key ingredients.
So what do you do? You publish a menu with the combinations of ingredients you can efficiently produce with a team of skilled people following specific methods like boil, bake, fry, toast, etc.
Wait, what does this have to do with an API? An API simikar in that you are saying…
I have some ingredients (raw data)
I can run some methods on them (get, put, post, delete, etc.)
I have a menu of combinations of those methods I am willing to offer you because I think you’ll like them (the API)
So, an API is analogous to a menu of items in your restaurant.
And the people in your restaurant are those fantastic engineers who built the code to make the methods run automagically each time someone requests something via your API.