What an API is
🏠The everyday picture
A restaurant menu and a waiter. You don't walk into the kitchen; you order from the menu, in the agreed way, and the waiter brings back what you asked for. The menu and waiter together are the kitchen's interface.
📘What it really is
-
An API (Application Programming Interface) is an agreed way for one program to ask another for something.
-
Most APIs you'll use are web APIs: you send an HTTP request to an address (an endpoint), and the server sends back data, usually as JSON.
-
Examples:
- a weather service: send a city, get the forecast;
- a payment gateway like Razorpay: create a payment, check its status;
- a maps service: send an address, get coordinates;
-
your own backend (Level 4): your frontend asks it for products and bookings.
-
API documentation tells you the endpoints, what to send, what you'll get back, the errors, and the limits. Reading docs is a core skill; AI can help explain them.
-
An API is also a promise of stability: if it changes without warning, every app that uses it breaks.
🖱️Try it
Open https://api.github.com/users/octocat in your browser. That's a real API response: data about one GitHub
user, in JSON. Find the user's name and number of public repositories in it.
✅Quick check
In the restaurant picture, what's the endpoint?
Show the answer
A specific item you can order from the menu: one address you can send a request to.
Your app uses a weather API and it suddenly breaks without any change on your side. What might have happened?
Show the answer
The API changed, is down, or your access (key, limit) changed. Check its status and documentation.
