REST API Fundamentals: HTTP Methods, Status Codes and JSON Payloads

~13 min read

REST is the dominant style for web APIs: HTTP methods say what ACTION you want, status codes say what HAPPENED, and JSON is the near-universal format for the actual data exchanged.

REST API Fundamentals: HTTP Methods, Status Codes and JSON Payloads is a Pro topic

Sign in, then upgrade to Pro or Power to unlock this topic and the full AI Engineering curriculum.

Key points

  • REST reuses standard HTTP with consistent conventions, so the same mental model works across almost every REST API
  • HTTP methods signal the ACTION: GET (read), POST (create), PUT/PATCH (update), DELETE (remove) — mapping onto CRUD operations
  • Status codes signal the OUTCOME: 2xx success, 4xx client-side error (400 bad input, 401 unauthorized, 404 not found, 429 rate-limited), 5xx server-side error
  • Always check the status code before trusting the response body — it's the first thing well-written API-calling code does
  • JSON is the near-universal data format for REST request/response bodies — nested key-value data that maps naturally onto Python dicts and lists