ABCsteps lesson path
How Apps Talk: APIs Revealed
Call a public API, inspect the response, and connect the idea to how modern applications communicate. Build one artifact, keep one review trail, and make the work easy to inspect later.
- Lesson
- 09
- Time
- 45 min
- Access
- public lesson
Learning objective
Understand requests, responses, status codes, and API contracts.
Lab outcome
Call an API and use the returned data in a small interface.
Module milestone
Containerize and share a working app through a verified deployment path.
Lesson proof workflow
Read, build, then review the evidence.
- Step 1ReadStart with API contracts before touching tools.
- Step 2BuildBuild toward: Call an API and use the returned data in a small interface.
- Step 3ReviewReview the evidence using Payload reading.
Toolchain
APIs are contracts between systems, not magic endpoints.
These are the practical surfaces used in this lesson. Learn the habit first, then connect it to the wider engineering ecosystem.
Call services and handle responses deliberately.
Read the data shape returned by an API.
Use response data inside a small app.
Proof of work
Leave one inspectable trail from this lesson.
The useful output is not a passive note. It is a small artifact another person can inspect: a working file, a command result, a commit, a screenshot, a README note, or a demo link.
Lesson lab: Call an API and use the returned data in a small interface.
Tool and platform logos are ecosystem references only: no affiliation, endorsement, interview access, hiring promise, salary promise, or placement guarantee.
Build
Produce the artifact
Complete the lab and keep the result visible: Call an API and use the returned data in a small interface.
Record
Save review evidence
Capture what changed, what broke, and how API contracts became clearer through the work.
Explain
Write the vocabulary
Use your own words for Request response flow and Payload reading; this is what makes the lesson inspectable later.
Skills companies recognize
Translate the lesson into inspectable work language.
This lesson turns one small lab into the language a learner can use in a README, demo note, or technical conversation. The point is not to collect logos; the point is to explain work clearly enough that another engineer can inspect it.
Where this skill appears
API thinking is a cross-company skill because every useful product eventually talks to another system.
Ecosystem references
Platform and company logos are ecosystem references only: no affiliation, endorsement, interview access, hiring preference, salary outcome, or placement guarantee.
README line
Name the artifact
Lab proof: Call an API and use the returned data in a small interface. Connect it to API contracts so the result reads like work, not a passive note.
Review line
Explain the stack
Use Node.js, JSON, JavaScript to explain Request response flow and what changed between the first attempt and the inspected result.
Conversation line
Answer with evidence
If a team asks about Payload reading, use this proof line: Show the request, response, status code, and how the UI changed after reading the payload.
Proof translation
Skill signal
API contracts is the market word. The lesson makes it visible through a small working artifact.
Proof artifact
The inspectable artifact is: Call an API and use the returned data in a small interface.
Interview answer
Use Request response flow and Payload reading to explain what changed, what failed, and how you verified it.
Paid guidance
Read publicly. Upgrade when guidance will help you finish.
This lesson remains part of the public written syllabus. Paid help is online-only and human-led: video walkthroughs as they roll out, live class context, WhatsApp Q&A, and project review around the same work.
No account wall, automated checkout, or placement promise is introduced here. Enrollment stays human-led by WhatsApp or call, and the useful proof remains the learner's own artifact.
Public
Written lesson stays open
Read the prepare and review material for lesson 09 on the public site before buying anything.
Recorded
Recorded and live guidance clarify the work
Paid guidance can add founder-led video walkthroughs as they roll out and live online class context; the teaching explains the work, but does not replace the written lesson.
Human
Questions use real context
When stuck, useful guidance starts from the route, error, screenshot, repo fragment, and the lab artifact: Call an API and use the returned data in a small interface.
Phase 1 · Briefing
Lesson briefing
Before You Study (5 mins)
Lesson focus: Lesson 08 made you fluent in reading JSON files locally. Today you read JSON files that live on other people's computers — anywhere in the world — by making your first API calls. When you tap "refresh" in any app, what happens under the hood is: your client opens an HTTP request, a server somewhere receives it, runs some logic, and sends back a JSON response. That cycle is what you're going to perform yourself today, deliberately, with curl first and then fetch() from your game.
What you should have ready:
- Terminal fluency from Lesson 04 — we'll use
curlextensively - Browser DevTools open (
F12orCmd+Option+I) — Network tab visible - Your Snake game project — we'll add an API call to it
- Internet connection — APIs require it
- About 60 minutes
The Concept
An API (Application Programming Interface) is a contract. The contract specifies: which URLs you can request, what HTTP method to use (GET, POST, ...), what headers to send, what shape the request body should have, and what shape the response will come back in. Your code holds up its side of the contract by sending well-formed requests; the server holds up its side by sending well-formed responses. When both sides honor the contract, two systems built by different people in different languages talk seamlessly.
The request–response cycle has a fixed shape:
┌────────────────┐ GET /weather?city=Mumbai ┌──────────┐
│ Your client │────────────────────────────────────────────▶│ Server │
│ (browser/app) │ │ (API) │
│ │◀─── 200 OK + JSON body ────────────────────│ │
└────────────────┘ └──────────┘
A request has four parts:
- Endpoint (the URL):
https://api.example.com/v1/weather?city=Mumbai - HTTP method (the verb):
GET,POST,PUT,PATCH,DELETE - Headers (metadata):
Content-Type: application/json,Authorization: Bearer <token>,User-Agent: ... - Body (payload, only on POST/PUT/PATCH): a JSON document with the data you're sending
A response has three parts:
- Status code (the verdict): a 3-digit number telling you the outcome
- Headers (metadata about the response)
- Body (the data, almost always JSON)
The five HTTP verbs each map to an intent:
| Verb | Intent | Idempotent? |
|---|---|---|
| GET | Read a resource — retrieve data | Yes |
| POST | Create a new resource | No |
| PUT | Replace a resource entirely | Yes |
| PATCH | Update part of a resource | Sometimes |
| DELETE | Remove a resource | Yes |
"Idempotent" means: doing the same operation multiple times produces the same end state. Calling GET /users/42 ten times returns the same user. Calling DELETE /users/42 ten times leaves the user equally deleted (the second call returns 404, but the system state is the same). POST /orders is not idempotent — calling it ten times creates ten orders, which is why retried requests need idempotency keys in production systems.
Status codes are a protocol with five families. A senior engineer can debug most issues from the status code alone:
| Family | Range | Meaning | Examples |
|---|---|---|---|
| 2xx | 200-299 | Success | 200 OK, 201 Created, 204 No Content |
| 3xx | 300-399 | Redirection | 301 Moved Permanently, 304 Not Modified |
| 4xx | 400-499 | Your mistake | 400 Bad Request, 401 Unauthorized, 404 Not Found, 429 Too Many Requests |
| 5xx | 500-599 | Server's mistake | 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable |
The instinct that separates beginners from senior engineers: when a request fails, the status code tells you immediately whether the bug is on your side (4xx) or the server's side (5xx). Don't blame their server when it returned 400.
Want the full architectural story — REST vs GraphQL vs gRPC, idempotency keys, authentication patterns, OpenAPI specs, the API economy? The companion article What is an API and How Do APIs Actually Work is calibrated to extend this lesson. Read it after today's hands-on practice to lock in the architectural model.
Quick Concepts
| Term | Simple Meaning |
|---|---|
| API | A contract for how programs ask another program for data |
| Endpoint | A specific URL on an API (/users/42, /weather, /quotes/random) |
| Request | What your client sends — method + URL + headers + body |
| Response | What the server sends back — status + headers + body |
| Status code | A 3-digit number telling you the outcome (200, 404, 500, ...) |
fetch() | The browser API for making HTTP requests from JavaScript |
curl | The command-line tool for making HTTP requests from your terminal |
What We Will Build
By the end of this lesson, you will have done these specific things:
- Made your first
curlcall to a public API in your terminal:Read the JSON that comes back. Recognized the structure:bashcurl https://api.quotable.io/randomcontent,author,tags. - Inspected the headers and status by adding the
-iflag:Identified the status code (200),bashcurl -i https://api.quotable.io/randomContent-Type: application/json, and Cloudflare'sServerheader. - Made a different request to test status codes — call a non-existent endpoint and watch a 404 come back:
bash
curl -i https://api.quotable.io/this-does-not-exist - Wrote your first browser-side API call in your Snake game using
fetch():javascriptasync function loadQuoteOfTheDay() { const response = await fetch('https://api.quotable.io/random') if (!response.ok) { console.error('API failed:', response.status) return null } const data = await response.json() return data } - Added a "Quote of the Day" to your loading screen by calling
loadQuoteOfTheDay()and showingdata.contentanddata.authorto the player. - Watched the request in DevTools' Network tab — found your call, expanded it, looked at Request Headers / Response Headers / Response body. The Network tab will be your debug surface for every API call you'll ever make.
- Triggered a 4xx and a 5xx on purpose to feel them: try a malformed request to a real API; turn off your wifi mid-call and observe the network failure.
- Added the
awaitandtry/catcharound your fetch so the game doesn't crash if the API is down — defensive programming for a world that occasionally fails.
The shift from curl (terminal) to fetch (browser) is intentional. Both make the same HTTP request under the hood; switching between the two as you debug will become second nature in Module C.
Think About
Before studying, consider:
- The "weather app" on your phone has no idea what the weather is. It knows how to ask a weather API. The actual atmospheric measurement is happening at sensor stations around the world, processed by NOAA / IMD / WMO, surfaced through APIs, and your phone is just the last mile. How many systems do you think a single weather check passes through?
- If
POST /orderscreates an order and your network is flaky and you retry the request, you might create two orders for one click. How would you design the API to make this safe? (Hint: this is exactly what idempotency keys solve in production.)
By the End
After this lesson, you'll:
- ✅ Have made your first
curlAPI call from the terminal - ✅ Know the 4 parts of a request and 3 parts of a response
- ✅ Recognize the 5 HTTP verbs and their intents
- ✅ Know what each status code family means (2xx success, 4xx your fault, 5xx their fault)
- ✅ Have called a real API from your Snake game using
fetch() - ✅ Have watched the call land in DevTools' Network tab
- ✅ Have wrapped the call in try/catch so a failed API doesn't crash your game
The internet is a conversation. Today you join it. 🛎️
Next lesson · 10
Milestone: Your App Is Online
Review the build, container, and deployment path, then verify the app is reachable outside your local machine.