Without API's, applications would be nothing more than just static screens that display dormant texts.
Let me break it down this way. On your Whatsapp application, you're able to perform certain actions and when you perform these actions, your contacts are able to see these changes. For example, when you change your profile picture, your contacts immediately see this change. When you send a Meme or sticker to your friend, he or she gets this message immediately (if you have a strong internet connection).
What makes all of this possible? I'll tell you: WhatsApp's API.
If you find yourself still wondering what an API is, don't worry. I'll break this further for you.
THE API-WAITER ANALOGY
Let's use this very popular explanation. Say you go to a restaurant and you want to order. You go through the menu and you see a dish that you like. You signal to the waiter and inform him of the exact dish that you want. He goes to the kitchen and informs the cook who then gives him the dish, which the waiter gives to you.
In this scenario, you did not care how the food was gotten or prepared. All you did was make the request and the waiter did the rest for you, right? Relating this to an API, you are the Mobile application that needs data, the waiter is the API and the cook/kitchen is the database or data store(where the information needed by the application is stored).
NOW, LET'S COME BACK TO REALITY
Let's relate this to real life. We'll use Medium as an example. If you have the Medium app and you open up the app, you'll be taken straight to the Homepage where there's like a loading Carousel that seems to be fetching or waiting for information, right?
Let's go through what happens during this period where the Homepage is loading. Right there, the App(Medium) asks its API: "Hey, what's up dude? I need me some personalized content for this currently logged in user so I can display some articles to her".
Then the API goes: "Alright buddy. Let me go to the Database and ask for her history and see the kind of things she's been reading lately so I can know the kind of content to ask the Database for".
After the API finds this data the Mobile app asked for, it sends it back to the app which then displays it.
The same goes for when you try to view your profile, the app asks the API to fetch your Profile details which the API fetches from the database and returns back to the app to be displayed for you to see.
Without the API, the app will be dataless(if there's ever a word like that). No data, just a bunch of buttons and screens that do nothing.
This is the relationship between an API and an application. An API is what allows you to send messages to your friends on WhatsApp and they get it immediately. An API makes it possible to view a WhatsApp status that was posted a minute ago. It's able to take that picture or video you uploaded through your WhatsApp status to the database to be stored or saved so your contacts can be able to see it.
I believe that you now understand that without API's, mobile apps will be nothing more than just empty screens with textviews, buttons and icons.
NEVER FORGET WHO YOUR ERRAND BOY IS
So, think of an API as a middleman or an errand boy that helps applications to communicate with other/external applications, databases or servers.
Please, note that API use is not only limited to Mobile apps(I use Mobile apps a lot because that's my area of specialty). It's used for Websites, as well as desktop apps and other API's too.
I believe that you now understand what an API is and does. In this article, I tried to explain the concept of API's in very simple, plain English without the technical Jargon.
In my next article, you'll be learning about the types of API's in more technical terms and in subsequent ones, you'll be learning how to consume API's in your Mobile app with ready-to-use codes.
Till we meet again, Gracias. Don't forget to leave a like if you found this article helpful.
Follow me on:
Github
Twitter
LinkedIn
Top comments (0)