Web Fundamentals REST Architecture HTTP Verbs & JSON

REST API Basics in Modern Full Stack Development

Explore how frontends and backends communicate using Representational State Transfer (REST). Master resource modeling, collection versus individual endpoints, HTTP method semantics (GET, POST, PUT, PATCH, DELETE), stateless communication, clean URL design, and status code handling.

Spec: RFC 9110 HTTP Semantics & REST Principles
Conventions: Resource-Oriented APIs & JSON
Est. Time: 50–65 Minutes

1. What is a REST API?

Architectural style connecting client user interfaces to server data

REST (Representational State Transfer) is an architectural style for designing networked applications. It is not a strict protocol or language; rather, it is a set of design principles that leverage the existing capabilities of the HTTP protocol to interact with web resources.

🔄 The Complete Full-Stack Flow:
CLIENT (Browser / React) → Dispatches HTTP Request (e.g. GET /api/products/42) → REST API (Node / Express / FastAPI) → Executes Business Logic & Queries Database → Returns HTTP Response (Status 200 OK + JSON Representation) → CLIENT updates the UI view.

2. Collections vs. Individual Resources

The structural foundation of resource-oriented URL design

Collection Resource

/api/products

Represents a set or list of entities.
• GET /api/products → List products
• POST /api/products → Create new product

Individual Resource

/api/products/42

Represents a specific entity identified by its unique ID.
• GET /api/products/42 → Read #42
• PATCH /api/products/42 → Update #42
• DELETE /api/products/42 → Remove #42

3. HTTP Verbs & The CRUD Mapping

Connecting database operations to standardized HTTP method semantics

HTTP MethodCRUD ActionIdempotent?Target ExampleExpected Status
GETREADYes (Safe)/api/products/42200 OK
POSTCREATENo/api/products201 Created
PUTREPLACEYes/api/products/42200 OK
PATCHPARTIAL MODIFYNo (in RFC 5789)/api/products/42200 OK
DELETEDELETEYes/api/products/42204 No Content

4. 🔥 Live Interactive REST API Playground

Configure HTTP methods, collection or item paths, and observe live simulated REST responses

Select a method and path above, then click "Send Request"...

5. 🔥 Live REST Resource Explorer

Switch between Products, Users, and Orders to explore real-world CRUD endpoint structures

GET /api/productsHTTP 200 OK
Response Representation Returned:
[
  {"id": 1, "name": "Mechanical Keyboard", "price": 4999},
  {"id": 42, "name": "Pro Laptop 16\"", "price": 85000}
]

6. 🔥 Build the API Request: Scenario Evaluator

Select the appropriate HTTP method and path for each scenario

7. RPC Action URLs vs. Resource-Oriented REST

Why modern engineering teams prefer resource-oriented REST conventions

RPC Action-Style (Verbs in URLs)

POST /getProducts
POST /createProduct
POST /updateProduct?id=42
POST /deleteProduct?id=42

Forces every request to use POST. URLs multiply rapidly as new actions are added.

Resource-Oriented REST

GET    /products
POST   /products
PATCH  /products/42
DELETE /products/42

Predictable, standardized interface. The HTTP method specifies the action, keeping the URL strictly identifying the resource.

8. 🔥 Final Full-Stack Challenge: Course Platform API

Design the REST endpoints for a modern learning management system

1. Retrieve all courses with pagination:
2. Create a new course in the catalog:
3. Partially update course #42's title:
4. Fetch all student enrollments for course #42:

9. Common REST API Pitfalls

Critical misconceptions to avoid in full-stack architecture

1. Thinking REST is a strict protocol: REST is an architectural style; HTTP is the underlying protocol commonly used to implement it.
2. Conflating PUT and PATCH: PUT replaces the entire resource representation; PATCH applies partial modifications to specific fields.
3. Action verbs inside URLs: Avoid POST /deleteUser/42. Use DELETE /users/42 instead.

10. Knowledge Check Quiz

Validate your REST API architecture and HTTP method mastery

TEST YOUR KNOWLEDGE

REST API Basics Architecture Knowledge Check

Validate your understanding of resources, representations, HTTP method semantics, statelessness, and RESTful routing.

Question 1 of 4Current Score: 0 / 0
Q1

Is REST a protocol or an architectural style?

11. Key Takeaways Checklist

Core concepts you have mastered in this module

REST is an architectural style using HTTP methods to interact with resources.
Collection (/products) vs Individual Resource (/products/42).
Methods convey intent: GET (read), POST (create), PUT (replace), PATCH (modify), DELETE (remove).
Statelessness: every request carries complete context without server session memory.
Status codes reflect transport result: 200, 201, 204, 400, 401, 403, 404, 500.
Resource representation (JSON) is distinct from the conceptual resource itself.