Day 84: API

I had a really hard time understanding what an API was when I first learned about the concept but then I found this really brilliant metaphor.

API (Application Program Interface) APIs allow software to communicate with each other. One program can call on another program's API, thereby obtaining the data and functionality of this other program.

To break it down even further, consider this scenario:

  • Mary is a chef and she has a tonne of different recipes. She decides to share these recipes with others, and sets up a phone number where people can call and ask for her recipes.
  • Joan wants to make chicken parmigan but does not have the recipe. She decides to call the number that Mary has provided.
  • Mary then provides the recipe for chicken parmigan
  • Using this recipe, Mary is able to cook chicken parmigan

In this case, Mary and Joan are the programs. The phone number that Mary sets up is the API that is used to pass information/data. The data in this case are the recipes that Mary has. If Joan decides that she wants to change up the recipe, she can do so as well i.e. manipulate the data that was provided.

Good right?! Hope it helps!