HTTP fundamentals
Requests, responses, methods, status codes and headers, with the same request written in four languages.
Updated
Every page load, API call and form submission is an HTTP exchange: a client sends a request and a server answers with a response. Once you can read both halves, most network bugs explain themselves in the browser's Network panel.
Anatomy of a request
A request has a method, a path, headers and an optional body. This is what one looks like as it travels to the server.
POST /api/lessons/42/progress HTTP/1.1
Host: strata.example
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...
Accept: application/json
{"completed": true}Anatomy of a response
The response starts with a status line, followed by headers and, usually, a body. The status code is the first thing to check when something goes wrong.
HTTP/1.1 201 Created
Content-Type: application/json
Cache-Control: no-store
Location: /api/lessons/42/progress
{"lesson": 42, "completed": true, "completedAt": "2026-11-29T10:24:00Z"}Methods
Status codes
The first digit gives the category: 2xx means success, 3xx a redirect, 4xx a problem with the request and 5xx a problem on the server. Learn the common ones by heart; they explain most bugs at a glance.
Headers that matter
Content-Typedescribes the format of the body, such asapplication/json.Accepttells the server which formats the client can read.Authorizationcarries credentials, such as a bearer token.Cache-Controldecides who may cache a response and for how long.ETagandIf-None-Matchlet a client revalidate its cached copy cheaply.
The same request in four languages
Here is the request from the top of this lesson, sent from the command line and from three programming languages. Pick a tab; your choice applies to every language example on the site.
curl -X POST https://strata.example/api/lessons/42/progress \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"completed": true}'Summary
- Requests carry a method, a path, headers and an optional body.
- Status codes group into success, redirects, client errors and server errors.
- Safe methods change nothing; idempotent methods can be repeated without harm.
- Headers control the format, authentication and caching of every exchange.
Finished this lesson?
Mark it complete to track your progress across every track in the curriculum.