HTTP and APIs

Beginner 10 min read

How a browser or another program talks to a server: requests, methods, status codes and JSON APIs.

Why it matters

Every web application, mobile app and integration is built on HTTP. Reading a request and its status code is the first step in debugging almost any backend problem.

Where it fits

  1. Plan & Design
  2. ● Develop › Backend
  3. Version control
  4. Verify
  5. Build & Package
  6. CI/CD
  7. Deploy
  8. Operate

What you will learn

  • Read an HTTP request and response: method, path, headers, body, status.
  • Choose the right method and status code for an API endpoint.
  • Explain why a server must validate every request it receives.

Before you start

A request and its response

Example
GET /api/projects/42 HTTP/1.1
Host: example.com
Accept: application/json

HTTP/1.1 200 OK
Content-Type: application/json

{"id": 42, "name": "My project"}
The client asks for a resource with a method and a path; the server answers with a status code, headers and a body.

Methods and status codes you meet every day

  • GET reads, POST creates, PUT/PATCH change, DELETE removes. GET must never change data.
  • 2xx success (200 OK, 201 Created, 204 No Content).
  • 4xx the client's mistake (400 bad input, 401 not signed in, 403 not allowed, 404 not found, 422 validation failed).
  • 5xx the server's mistake (500 a bug, 502/504 the app behind the proxy did not answer).

Watch out: Treat every request as untrusted: validate input, check that the user may access the resource, and never return more data than the caller needs.

Tip: Open your browser's developer tools (Network tab) on any site to see real requests, headers and status codes.

Official documentation and references

Guides

Reference

Specifications

Practise in Zerethon IDE

Learn next

Done with this topic?

Reviewed 2026-10-23. Links go to the official documentation unless marked otherwise.