HTTP
The request-and-response language browsers and websites speak.
HTTP (HyperText Transfer Protocol) is the set of rules a browser and a web server use to talk. The browser sends a request (give me this page) and the server sends back a response (the page, or an error). Every web page, image and API call you use runs on this simple back-and-forth.
A request has a method and a path. GET /menu means fetch the menu; POST /order means here is some data, create an order. The response starts with a status code: 200 is OK, 404 is not found, 500 is the server broke. Both carry headers, small notes such as the type of content, the language, or a cookie that identifies you.
HTTP is stateless: each request stands alone, and the server does not remember the previous one, which is why cookies and sessions exist. Plain HTTP is readable by anyone in between, so today almost everything uses HTTPS, which is the same conversation inside an encrypted tunnel. Newer versions (HTTP/2 and HTTP/3) make the exchange faster without changing what you ask for.
Keep in mind
- A request has a method (
GET,POST...) and a path; a response has a status code (200,404,500). - HTTP is stateless: cookies are how a site remembers who you are between requests.
- HTTPS is HTTP with encryption; the conversation is the same, only protected.
- Most APIs on the web are just HTTP requests that return JSON instead of pages.