Class 7 · CBSE AI · Strand B — Python for AI
What is an API? The mental model every coder needs — Class 7
An API is a contract for how two programs talk. REST, GET and POST explained simply. For Class 7.
Class 7 · CBSE AI · Strand B — Python for AI
An API is a contract for how two programs talk. REST, GET and POST explained simply. For Class 7.
Bank teller window
An API is like a bank teller window. There is a specific form to fill in (the request format), you need your ID (the API key), there is a maximum number of transactions per day (rate limit), and you get a standardised slip in return (the response). You do not need to know how the bank's internal systems work — just the interface at the window.
IRCTC train booking
When you book a train on IRCTC, you do not talk directly to the railway's database. You use a defined interface — select train, enter details, pay, receive confirmation. That interface is an API. IRCTC's app and your booking are on one side; the railway's servers are on the other, connected by a contract.
Every Dhee Learning session for this concept follows three stages. We share the questions Dhee actually asks, so you can hear what a session sounds like.
Stage 1 — Surface
You have used two APIs now — one for images and one for language. What do they have in common? What pattern did you notice in how you talked to both of them?
Rote answer
"Both need an API key and you send them something and get something back"
Understood
"Both follow the same request-response pattern with a defined input format, authentication to prove who you are, and a structured response you can parse — the specific content is different but the contract is the same"
Stage 2 — Reasoning
Why does an API have rate limits — a maximum number of requests per minute? Who benefits from rate limits, and who is inconvenienced by them?
Follow-up Dhee may use: If you are building a product that many users will use simultaneously, how does rate limiting change how you design your system?
Stage 3 — Application
An API returns a 401 error. Another returns a 429 error. A third returns a 200 but with an empty response body. What is wrong in each case, and what would you do to fix it?
Misconception Dhee watches for: Treating all errors as 'the API is broken' rather than reading the error code to diagnose what specifically went wrong
Dhee turns this concept into a 15-minute spoken session — asking, listening, and probing — so your child builds the idea themselves.
An API is a contract for how two programs talk. REST, GET and POST explained simply. For Class 7.
Once an API is working, it will always work the same way — in reality, APIs are versioned and providers deprecate old versions; code must be maintained
Dhee opens with a question — for example: "You have used two APIs now — one for images and one for language. What do they have in common? What pattern did you notice in how you talked to both of them?" — listens to your child's answer, then probes the reasoning behind it. The session ends when the child can apply the idea to a brand-new situation, not just recall it.