Restaurant analogy: the customer orders from a waiter, who takes the order to the kitchen and brings back the food. Which part is the API?
Options
- The customer, who makes the order and waits for the food
- The waiter: the agreed way to ask the kitchen and get an answer (Correct option)
- The kitchen, where the food is made and then served
- The price list, which the customer reads before ordering
Answer
The waiter: the agreed way to ask the kitchen for something and get an answer, without entering the kitchen
Why
An API (Application Programming Interface) is a contract about how programs talk to each other.
- Customer = the client app (browser, mobile app).
- Waiter = the API: you order using the menu (the documented requests), and you get a response.
- Kitchen = the backend that does the real work.
The customer does not need to know how the kitchen works, only how to order.
Remember
API = the waiter between client and backend.