How APIs work · Demo 1 of 4
Watch one request travel
An API is a server you can ask questions. Pick a city, send the question, and follow it: out of the browser, to the server, and back as data that becomes a design.
1 Ask a question
Nothing has been sent yet. The browser is waiting for you.
2 The interface: what the user sees
The design has no data yet.
Behind the scenes · what travelled between them
The request: what the browser sent
A request is mostly just an address. Change the city and watch which part changes.
- ProtocolThe language both sides speak (HTTP, encrypted).
- HostWhich server to ask. Like the shop's address.
- PathWhich service at that server: the forecast desk.
- QueryThe details of the question: where, and which values.
The response: what the server sent back
Send a request to see the raw data.
What to notice
- The browser asks; the server answers. Never the other way round.
- The question is written as a URL. Only the query changes between cities.
- The answer is plain data (JSON) with no colours, fonts or layout.
- The server sent far more than the card shows. Design chose what to use.
Explain it back
- Which part of the URL tells the server which city?
- What does the status code 200 mean? What might 404 mean?
- Find a value in the JSON the card does not show. Where would you put it?
- If the server took 5 seconds, what should the card show meanwhile?