1The Problem
2Your Role
3The Game
4Debrief
5The Idea
6Try It Yourself
Chapter 1 · The Problem

๐Ÿ“š The Archive You Can't Walk Into

You are a student who needs a rare book for your project. The book sits somewhere in the library's archive: endless shelves, dusty boxes, trolleys and staff who all know their own sections.

You could try walking in and finding it yourself. But you don't know how anything is shelved, you'd be in everyone's way, and a hundred other students would try the same.

Life has many situations like this. A farmer wants to sell grain in a huge, crowded wholesale market. A traveller wants a train ticket from a railway office buzzing with files and staff. In each case, one side wants something from a busy place, and neither side should have to understand the other's inner workings.

How can a request go in and the book come back, without anyone having to enter the mess? Let's find out by playing ๐Ÿ‘‡

Chapter 2 · Your Role

You're the Student in a Hurry

How to play: press Auto to watch the story play by itself, or click through step by step. Pause, Next and Speed are always there if you need them.

Chapter 3 · The Game

Request a book, discover something bigger

Play through the library. When the game ends, the Continue button unlocks.

๐Ÿš€

You finished the library!

0
Game score

You just used a clever idea without knowing its name. First, let's reflect on what you saw. The name comes in Chapter 5.

Chapter 4 · Debrief

Reflection

Think about these in your own words before moving on.

1When the game started, why did you first want to go into the archive yourself, and what made you change your mind?
2When the librarian left, why did you choose the request desk? How could it work without the librarian?
3What did you need to know to make a request, and what did you never need to know?
4Before the archive was rebuilt, what did you predict would happen to your request, and why?
5Where else in your life do you get something without seeing how itโ€™s made? What works like the request desk there?
Chapter 5 · The Idea

The idea behind the library

The librarian you invented has a name in the software world.

๐Ÿš€

You Discovered: API

What happened in the library:

  • Going straight into the archive was chaotic for everyone.
  • A librarian in the middle took your request in, and brought the book back. You never touched the archive.
  • Every order followed the same simple path, whether a book, a journal or a thesis.
  • When the archive was rebuilt, your way of requesting stayed the same, so nothing broke for you.
  • You see this outside libraries too: a commission agent in a crop market, a bank teller, a railway booking counter.

Now we can give names to what you did. In the world of computers, the librarian's job has a name: the API.

An API (Application Programming Interface) is a way for one piece of software to ask another for something, and get an answer back, without knowing how the other one works inside.

๐Ÿ‘ค Clientthe one who asks
request โžœ
โฌ… response
๐Ÿง‘โ€๐Ÿ’ผ APIthe agreed way to ask
request โžœ
โฌ… response
๐Ÿ–ฅ๏ธ Serverthe one who does the work
Library StorySoftware Concept
StudentClient (an app or website)
Librarian and the way of requestingAPI
ArchiveServer
Request slipRequest
Book coming backResponse
The fixed way of requestingInterface (the agreed rules)
CatalogueDocumentation of what you can ask for
Archive rebuilt, requesting unchangedServer changes behind a stable API

๐Ÿ”‘ Key Learnings

๐Ÿšช
Hide the complexity

An API lets you use a system without knowing what happens inside it.

๐Ÿ“ฆ
Request and response

Every conversation has two parts: you ask (request), and you get an answer (response).

๐Ÿ”ง
Change without breaking

As long as the way of asking stays the same, the inside can be rebuilt freely.

๐ŸŒ
Everywhere

Weather apps, UPI payments, maps in delivery apps, and mandi-price apps all use APIs.

๐Ÿงช Back to the CSE Concept Laboratory
Chapter 6 · Try It Yourself

Exercise Questions

Apply what you learned to new situations. Think through each one before moving on.

01 · The Library Request Desk

Which of these work like a libraryโ€™s request desk: a power socket, a restaurant waiter, cooking Maggi at home, or UPI payment at a shop?

For each example that does not work like a request desk, what is missing? Identify what makes something an API.

02 · Design the Libraryโ€™s Request Slip

Imagine a library has an archive where all books are stored. Students cannot access the archive directly; they must submit a request through a request desk.

What information must every request include? What different responses could the archive send back besides โ€œHere is your bookโ€?

If you were designing this as an API, which HTTP methods would you use to request, add, update, or remove information?

03 · One Source, Multiple Applications

A universityโ€™s mobile app and website maintain separate attendance records, which often disagree.

How would you design one system so both applications access the same data and always display consistent attendance information? What role would an API play in this system?

04 · Different Users, Different Permissions

Students view marks, teachers update marks, and parents view their childโ€™s marks, all from one database.

How would you design the API so each user can access only the information and operations they are authorized to use? How would the system identify and verify each user?

05 · Too Many Requests!

A weather app sends 50 separate requests for 50 cities every time it opens.

How could you make this process faster and reduce unnecessary API requests? Could you retrieve multiple citiesโ€™ weather information together or temporarily store previously received results? How long should a saved weather result be considered valid?

06 · The Double Booking Problem

A cab booking request is successfully processed, but the confirmation message gets lost. The customer assumes the booking failed and taps โ€œBookโ€ again.

How would you prevent the system from creating two bookings for the same request while still allowing the customer to retry safely?

07 · Updating Without Breaking the Old System

A library now wants every request slip to include a student ID, but thousands of students are still using the old version of the slip.

How would you introduce this change without breaking the existing system? How does the same problem occur when an API is updated while older applications are still using it?

08 · Design the Request Desks for a Hospital

Imagine designing a hospital system with separate departments for reception, laboratory, pharmacy, and billing.

How would you design the APIs for these departments so they can communicate and exchange information? Where does the library request desk analogy stop working when applied to a real software system?

๐Ÿงช Back to the CSE Concept Laboratory