The Internet & APIs

How programs exchange data without ever meeting in person.

Fundamentals 14 min Beginner April 13, 2026

Every time you open a website, your computer sends a precisely formatted letter to another computer that might be sitting in a data center thousands of kilometers away — and gets a reply in under a second. How does your browser know where to send that letter? And how does the response find its way back?

The answer lies in three ideas that power every app, every cloud service, and every AI chatbot. By the end of this article, you will understand what happens between pressing Enter and seeing a web page — and why the exact same mechanism also powers AI services.

Client and Server: The Restaurant Model

Client, Server, and HTTP

AnalogyDefinition
Imagine a restaurant: you (the client) order from the menu, the waiter (the network) carries the order to the kitchen (the server), and the kitchen prepares a dish and sends it back via the waiter. Client and server are not specific devices — they are roles. Your smartphone is a client when it loads a web page, but it could also act as a server.

Where the restaurant analogy breaks: a web server handles thousands of clients simultaneously — no physical restaurant can do that. A server can itself become a client when it fetches data from other servers (microservices). And the network is unreliable: data packets can be lost, delayed, or arrive out of order — a human waiter rarely drops the plate.

What happens when you type google.com?

1
DNS resolution: your browser asks for the IP address of google.com (~50 ms)
2
TCP connection: browser and server establish a reliable connection (~30 ms handshake)
3
HTTP request: the browser sends a GET request to the server
4
Server processing: Google's server generates the response page (~200 ms)
5
HTTP response: the server sends back HTML, CSS, and JavaScript
6
Rendering: the browser assembles the page and displays it — all in under 500 ms

Common Misconception: Internet = Web

The internet and the web are not the same thing. The internet is the global network infrastructure — cables, routers, protocols. The web (World Wide Web) is just one of many applications running on the internet, alongside email, file transfer (FTP), streaming, and much more.

Addresses: IP and DNS

IP Address, DNS, and Port

AnalogyDefinition
DNS works like a chain of phone books. Instead of one giant directory, there is a tree: the root directory knows which regional directory to ask (.com, .de), the regional directory points to the company directory (google.com), and the company directory has the actual extension number (IP address).
4.3 B
IPv4 Addresses Sounds like a lot — but not enough for every device on Earth
~50 ms
DNS Lookup Time for a full name resolution without cache
443
HTTPS Port The standard port for encrypted websites

Think of DNS as a phone book chain: your browser first checks its local cache, then asks your internet provider, which asks a root server, which points to the .com server, which knows the IP address of google.com. The result is cached so the next lookup is faster.

Where the analogy breaks: real phone books are static publications updated yearly. DNS records can change within minutes (controlled via Time-to-Live, or TTL). Also, DNS queries are active network requests to live servers — not passive lookups in a printed book.

DNS Resolution: Step by Step

1
Browser checks the local DNS cache — maybe this site was visited before
2
If not cached: request goes to the ISP's recursive resolver
3
The resolver asks a root server: who handles .com?
4
The .com TLD server responds: Google uses these nameservers
5
Google's authoritative nameserver returns the IP address (e.g., 142.250.x.x)
6
The resolver caches the result with TTL and forwards it to the browser

Ports are like extension numbers in a phone system: the IP address is the building's main number, the port is the extension to the right desk. Port 80 is HTTP, port 443 is HTTPS (encrypted), port 22 is SSH (secure remote access). A server can offer many services simultaneously — each listens on a different port.

Common Misconception: My IP address identifies me personally

Most home internet connections have a dynamic IP address that changes regularly. Additionally, many devices often share a single public IP address (via NAT). Your IP address is neither permanent nor personally identifiable — it is more like the current phone number of a hotel room.

APIs: The Menu for Machines

API, REST, and JSON

AnalogyDefinition
An API is like a standardized menu at a restaurant counter. The menu lists exactly what you can order (endpoints), what options are available (parameters), and what you will receive (response format). As long as you follow the ordering protocol, you get your result — regardless of whether you are a web app, a mobile app, or a server process.

Where the menu analogy breaks: API responses can be deeply nested data structures with hundreds of fields — far more complex than a single dish. APIs often require authentication (API keys, tokens) — no restaurant demands an ID check before ordering. And APIs enforce rate limits (e.g., 100 requests per minute) — a concept with no dining equivalent.

Website (Browser)

The server delivers HTML code with colors, images, and layout. The browser renders the visible page. Optimized for human eyes.

API (Program)

The server delivers structured JSON data: {"temp": 18, "condition": "cloudy"}. A program processes the data further. Optimized for machines.

A concrete example: a weather API call looks like this: GET https://api.example-weather.com/current?city=Berlin with an API key in the header. The response comes as JSON: {"temp": 18, "unit": "celsius", "condition": "cloudy"}. No colors, no images — just the raw data that any program can process.

Here is the exciting part: an AI API call follows the exact same pattern. Instead of a city, you send a prompt: POST https://api.example-ai.com/chat with {"prompt": "What is DNS?"} — and the response comes as {"response": "DNS stands for..."}. Same HTTP, same JSON, different kitchen: instead of a database, a neural network processes the request.

Common Misconception: APIs are only for programmers

Every app on your smartphone uses APIs behind the scenes, even if you never see them. The weather widget calls a weather API, the transit app queries a transportation API, and chat notifications arrive via a messaging API. APIs are the invisible infrastructure on which most digital services are built.

HTTP speaks a small vocabulary: GET means 'read something', POST means 'send/create something', PUT means 'replace something', DELETE means 'remove something'. These four cover the fundamental operations (read, create, update, delete).

Status codes are the server's short answers: 2xx means success (200 OK = all good), 4xx means 'you made a mistake' (404 Not Found = page does not exist, 403 Forbidden = no access), 5xx means 'the server has a problem' (500 Internal Server Error). Next time you see '404', you will know exactly what that number means.

A weather API works like this: the client sends a city name, the server queries its database, and returns the temperature as JSON. An AI API works identically: the client sends a prompt text, the server runs a neural network, and returns the generated text as JSON.

The HTTP layer is identical in both cases — only the server-side processing differs. Whether it is a database query or a neural network: to your code, it looks the same. You will encounter this pattern again and again in later articles when you fetch models from Hugging Face or use AI tools via their APIs.

Interactive: The Journey of an HTTP Request

HTTP Request: From Browser to Server

Click "Play" and follow step by step what happens when your browser calls an API — from entering the URL to receiving the JSON response.

BrowserEnter URLCLIENTDNS→ IP AddressRESOLUTIONTCP/TLSHandshakeCONNECTIONGET /apiHeader + BodyREQUESTSERVER200 OK{ "temp": 22 }RESPONSEJSON Data
Step 0 of 6
Start animation

Click "Play" to see the RAG pipeline step by step.

Why does this matter?

Every website, every app, and every AI application uses HTTP requests in the background. Once you understand how a request is structured and what steps it goes through, you can use APIs deliberately, find errors more quickly, and understand how modern software communicates.

Key Takeaways

  1. The internet follows a simple pattern: a client sends a request, a server sends back a response — this is true for websites, weather apps, and AI chatbots alike.
  2. DNS is the internet's phone book: it translates human-readable names like google.com into numeric IP addresses that routers use to deliver data packets.
  3. An API is a standardized interface that lets programs talk to other programs. Every app on your phone uses APIs behind the scenes.
  4. JSON is the universal packaging format for API data: structured, human-readable, and understood by every programming language.
  5. The cloud is not a mystical place — it is data centers full of servers that expose APIs, following the same client-server principles as any website.

Quiz: Internet & APIs

Question 1 / 4
Not completed

What is the role of DNS on the internet?

Select one answer
Answer Key: 1) B · 2) B · 3) C · 4) C

Comprehension Check

  • You type google.com, but the page does not load. A friend asks: "What does the browser actually do before it can show the page?" Explain the steps.
  • Someone says: "DNS is like a phone book." Explain why this analogy works in principle — and where it breaks down.
  • Your weather widget shows the temperature for Berlin. A friend asks: "Where does the app get the data?" Explain the difference compared to a regular website.