A metaphor of API

Think of an API like a menu in a restaurant. The menu provides a list of dishes you can order, along with a description of each dish. When you specify what menu items you want, the restaurant’s kitchen does the work and provides you with some finished dishes. You don’t know exactly how the restaurant prepares that food, and you don’t really need to.

An API is very much the same thing as a UI, except that it is geared for consumption by software instead of humans.

How API works

img An API is not a database. It is an access point to an app that can access a database.

Why would we need an API?

You (as in, your application, or your client, this could be a web browser) wants to access another app’s data or functionality. For example, to access all posts with a specific hastag from a IG.

You could write an email and ask for all these posts. The problems are:
1. You may not get any replied.
2. Even get replied, you have to find a way to import the data into your application.
3. Even imported, the information is not up to date.

So a better solution would be: - Provide a way for user to query the application to get that data.

So, API is more like providing options to potential users, they can get information from your application themselves. And the requests to retrieve or write data are generally done without frontend, but by sending an HTTP request to a server.

How to build an API?

  1. Find the API provider, for example:
  2. Read through the documentation to make sure the API is workable.
  3. Understand the data structure.
  4. Call the API from your own application and process the data.

Reference

  1. What is an API? In English, please.
  2. What is an API
  3. What exactly is an API
  4. What Are APIs and How Do They Work?

Build Status