API

Key points of this
  • It’s the embodiment (entity) of a class (blueprint).
  • It comes up in the discussion of object-oriented
I’ll write it simply.

What is API ?

A window (or set of rules for how to use) for requesting work on a function, which is provided to allow that function to be used from programs unrelated to that function.

What is an API?

API stands for Application Programming Interface. It refers to a “gateway” or “interface” that allows external programs to interact with a specific function or system. This “gateway” includes the rules and procedures for accessing and using the function.

Example of an API

Consider a system called “System A” that provides a service where inserting money gives you a cake and coffee. System A has two functions:

  • A function to make a cake when money is inserted
  • A function to make coffee when money is inserted

Now, imagine you want to develop a new system, “System B,” which will provide a cake and milk when money is inserted. To simplify the development, you would like to use System A’s “cake-making” function.

The developers of System A can provide an API for the “cake-making” function. This API acts as a “gateway” allowing System B to access and use the cake-making functionality of System A. The API receives requests from System B, communicates them to the cake-making function, and returns the results.

Details of an API

An API is essentially a set of rules and procedures for accessing a function or system. It defines how external programs should interact with the function. For instance, an API includes:

  • The location where the function can be accessed
  • The type of data required to make a request (e.g., cash, card)
  • The method for receiving the response (e.g., how to receive the cake)

Typically, APIs are seen as “gateways” for accessing functions. For example, a “Web API” is a gateway for using web-based functions from external programs.

Summary

In short, an API is a “gateway” or “interface” that includes rules for requesting and using a specific function. When you encounter the term API, think of it as a “gateway” to access a function or service from external programs. This perspective helps in understanding the purpose and role of APIs.