Pathubs Logo Mark
PATHUBSFREE CAREER ROADMAPS
HomeExploreDiscoverCompare ⚖️My Progress 📊Support
Student Support & Feedback

Have Questions or Need Help?

Have questions, feedback, or suggestions for new roadmaps and interactive tools? Reach out to our team — we review every message to make practical learning better for everyone.

supportpathubs@gmail.com Official Telegram Support (@PathubsSupport)
Pathubs

100% Free, Zero-Paywall Tech Career Roadmaps, In-Depth Practical Content, and Live Interactive Virtual Labs for Learners Worldwide.

Popular Careers

  • Frontend Development
  • Backend Development
  • AI & LLM Engineering
  • Full Stack Web Dev
  • Data Analytics

Platform Tools

  • Career Discovery Quiz
  • Compare Careers

Contact & Info

  • About Us
  • supportpathubs@gmail.com
  • Support Pathubs

© 2026 Pathubs. All Rights Reserved. Structured learning, practical content, and hands-on practice for learners worldwide.

AboutPrivacy PolicyTerms & ConditionsSitemapRobots
  1. Home
  2. Backend Developer
  3. APIs & Authentication
  4. REST API Design
APIs & AuthenticationIETF RFC 9110Roy Fielding ArchitectureResource-Oriented Modeling

REST API Design — Resource Modeling & HTTP Semantics

Learn how to design clean, predictable, and maintainable REST-style APIs around resources and HTTP semantics. Move beyond naive "REST = CRUD" simplifications to understand architectural constraints, safe vs. idempotent methods, hierarchical URL structures, parameter placement, and industry-standard conventions.

The Cardinal Rule of REST URIs

URIs represent nouns (resources), never verbs (actions). Let HTTP methods (GET, POST, PUT, PATCH, DELETE) define the operations executed upon those resources.

Step 1
Target Resource
Identify noun collection or item (e.g. /courses/42)
Step 2
Method Semantics
Select safe vs idempotent verb (GET, POST, PATCH)
Step 3
Parameter Channel
Path for identity, query string for filters/pages
Step 4
HTTP Status Signal
Return standard status code (200, 201, 204, 400)
Standard Specification
IETF RFC 9110 Semantics
Core Paradigm
Resource-Oriented URIs
Interactive Practice
API Designer & 7 Debug Labs
Estimated Duration
55 - 70 Minutes

Curriculum Outline & Directory

01
What REST Really Means
Fielding Constraints & Representation
02
Resource-Oriented Modeling
Nouns vs Verbs & Flat URL Hierarchies
03
HTTP Method Semantics
Safety, Idempotency & RFC 9110 Matrix
04
Parameters & Responses
Path vs Query String & Status Codes
05
Interactive API Designer
Live Course Platform Playground
06
Production Debugging Labs
7 Real-World Anti-Patterns & Diagnoses
07
Bookstore API Challenge
Interactive 5-Endpoint Validator
08
Architectural Recap & 5 Rules
Checklist & Best Practice Principles
09
Mastery Quiz
7 Interactive Self-Check Questions
01

What REST API Design Really Means

Deconstructing Roy Fielding's architectural style and distinguishing real REST from generic HTTP APIs.

In modern web development, the term REST (Representational State Transfer) is frequently used as a loose buzzword for any HTTP server that returns JSON. However, REST is not a protocol, a software library, or a standard JSON format. It is an architectural style introduced by computer scientist Roy Fielding in his 2000 doctoral dissertation on network-based software architectures.

Fundamental Principle:
An HTTP API that simply sends JSON over GET and POST is not automatically RESTful. REST is an intentional architectural contract built upon resources, representations, statelessness, and a uniform interface.

Core Architectural Concepts

1. Resource

The central abstraction in REST. Any conceptual entity that can be named and addressed is a resource: a user, a product catalog, an order, or a real-time weather report. Every distinct resource is assigned a persistent, unique identifier (URI).

2. Representation

Clients never directly manipulate raw database tables or memory. Instead, clients exchange representations of the resource. A single user resource might be represented as application/json, application/xml, or text/csv. REST does not mandate JSON!

3. Uniform Interface

Provides a predictable, standardized interaction model across the entire distributed system:
• Resource identification via URIs (/courses/42)
• Manipulation via representations (HTTP verbs)
• Self-descriptive messages (Headers like Content-Type)
• Hypermedia controls (HATEOAS links guiding next possible actions)

4. Statelessness

Every client request to the server must contain all of the contextual information necessary to complete the operation. The server never stores client session state between requests. This allows servers to scale horizontally without sticky sessions.

Why REST Commonly Uses HTTP

Although Fielding designed REST to be protocol-independent, HTTP/1.1 and HTTP/2 are the natural embodiments of REST because HTTP already provides:

  • Universal Resource Identifiers (URIs): Direct naming of resource locations.
  • Standardized Request Verbs: Well-defined operational semantics (GET, POST, PUT, DELETE).
  • Standardized Status Codes: Granular outcome signaling (200, 201, 404, 409).
  • Content Negotiation Headers: Accept and Content-Type to exchange representations.
02

Resource-Oriented API Design: Nouns vs. Verbs

How to identify resources, structure intuitive URL hierarchies, and avoid RPC-style action endpoints.

The most frequent mistake in API design is treating URLs like remote procedure call (RPC) function names. In an RPC API, developers invent arbitrary verbs for every operation:

RPC-Style Action URLs (Anti-Pattern)Arbitrary, Inconsistent, Fragile
POST /createUser
GET  /getUserById?id=42
POST /updateUserAddress
POST /deleteUser?id=42
POST /generateUserInvoice

In contrast, a Resource-Oriented REST API uses URLs exclusively to name nouns (the resources). The action being performed is expressed entirely by the standard HTTP method:

Resource-Oriented REST URLsClean, Predictable, Standardized
POST   /users            -- Create a new user in the collection
GET    /users/42         -- Retrieve representation of user #42
PATCH  /users/42         -- Partially modify user #42
DELETE /users/42         -- Remove user #42
POST   /users/42/invoices -- Create an invoice sub-resource for user #42

Collections vs. Individual Resources

RESTful URLs follow a clear structural cadence:

  • Collection Resource (/products): Refers to the set as a whole. Sending GET /products lists items; sending POST /products adds a new item to the collection.
  • Individual Item Resource (/products/42): Refers to a specific entity identified by its key. Sending GET /products/42 inspects that single entity; sending DELETE /products/42 deletes it.
  • Sub-Resource Collection (/orders/42/items): Represents items that conceptually live inside order #42.
Beware the Deep Nesting Trap:
Do not create deeply nested URLs like /authors/12/books/45/chapters/2/paragraphs/8. Deep nesting is brittle, makes client code cumbersome, and creates tight coupling. If an entity has its own primary key, keep URLs flat: /paragraphs/8 or at most one level of parent scoping: /chapters/2/paragraphs.
03

HTTP Method Semantics under IETF RFC 9110

Connecting resource design with the precise semantics of Safe and Idempotent HTTP methods.

The IETF HTTP specification (RFC 9110) categorizes HTTP request methods by two crucial operational properties: Safety and Idempotency. These properties dictate how web clients, proxies, load balancers, and browsers interact with your API.

MethodSafe?Idempotent?RFC 9110 Resource SemanticCommon Response Status
GETYESYESTransfer a current representation of the target resource. Must NOT alter server state.200 OK
POSTNONOProcess the representation according to the resource's specific semantics; create subordinate resources.201 Created, 200 OK
PUTNOYESReplace all current representations of the target resource with the request representation.200 OK, 204 No Content
PATCHNONO (RFC 5789)Apply a set of partial modifications or instructions to the target resource.200 OK, 204 No Content
DELETENOYESRemove the association between the target resource and its current functionality.204 No Content, 200 OK
Safe Methods (Read-Only)

A request method is safe if its semantics are essentially read-only: the client does not request, and does not expect, any state change on the origin server.

Search engine crawlers, browser link pre-fetchers, and CDNs aggressively execute GET requests assuming they will never mutate data.

Idempotent Methods (Safe to Retry)

A method is idempotent if the intended effect on the server of multiple identical requests is the exact same as for a single request.

If a client sends DELETE /orders/42 and the network drops before receiving the response, the client can safely retry without side effects.

PUT vs. PATCH: The Critical Distinction

Developers often confuse PUT and PATCH:

  • PUT (Replacement): You send the complete new representation. If a user has 5 fields and you send only {"name": "Alice"}, a strict PUT will erase the other 4 fields or fail validation!
  • PATCH (Partial Modification): You send only the delta or specific fields to update. The server applies changes to the existing representation without touching other fields.
04

Parameters: Path vs. Query String vs. Request Body

Establishing clear conventions for filtering, sorting, pagination, and status code signaling.

Every API request carries parameters. Clean REST design establishes clear rules for where each piece of data belongs:

1. Path Parameters (/items/{id})

Purpose: Identifies a specific resource or establishes hierarchy.

Rule of thumb: If removing the parameter changes WHICH entity is being addressed, it belongs in the path.

GET /users/42/orders/108

2. Query Parameters (?filter=...)

Purpose: Filters, sorts, paginates, or shapes the representation.

Rule of thumb: If removing the parameter still targets the same base resource collection, it belongs in the query string.

GET /products?category=books&sort=-price&page=2

Standard Query String ConventionsFiltering, Sorting, Pagination
-- Filtering by field value:
GET /products?category=electronics&in_stock=true

-- Sorting (prefix '-' or desc for descending):
GET /products?sort=-price,created_at

-- Pagination (page-based or limit/offset):
GET /products?page=3&limit=20
GET /products?offset=40&limit=20

-- Field Selection / Projection:
GET /users?fields=id,name,email

Appropriate HTTP Status Codes

REST APIs communicate the result of operations through standard HTTP status codes:

  • 200 OK — Standard response for successful GET, PUT, or PATCH.
  • 201 Created — Returned by POST when a new resource is created; should include a Location header with the new resource URI.
  • 204 No Content — Successful request where no body is returned (typical for DELETE).
  • 400 Bad Request — Malformed syntax or invalid client input.
  • 404 Not Found — Target resource URI does not exist.
  • 409 Conflict — Request conflicts with current resource state (e.g. duplicate email address).
  • 422 Unprocessable Content — Well-formed syntax but semantic validation failure.
05

Interactive REST API Design Playground

Practice designing endpoints for an Online Learning Platform. Match HTTP methods, URLs, parameters, and status codes to real requirements.

Application Domain: Online Learning Platform

Resources available in domain: users, courses, lessons, enrollments.

Select API Requirement to Design:
1. List Courses (Paginated)
Retrieve a paginated list of all published courses with optional sorting.
2. Get Single Course
Fetch complete details of course #101.
3. Create a New Course
Publish a new course with title, description, and price.
4. Partially Update Course Details
Update only the price of course #101 to $49.
5. Delete a Course
Permanently remove course #101 from the catalog.
6. List Lessons for a Course
Retrieve all lesson sub-resources that belong to course #101.
Designing: 1. List Courses (Paginated)Requirement #1
06

Production Debugging: 7 Realistic Bad API Designs

Identify and fix real-world anti-patterns including action verbs in URLs, unsafe GET mutations, and excessive nesting.

Bug #1: RPC Action Verb in URLAnti-Pattern
Problematic API EndpointViolates REST Constraints
GET /getAllUsers

The endpoint embeds an action verb ('getAll') into the URI instead of letting HTTP GET define the operation over a noun collection.

Select the Correct RESTful Redesign:
A.GET /users
B.POST /users/all
C.GET /usersList
D.FETCH /users
07

Mini Challenge: Complete Bookstore API Contract

Design a consistent, production-ready REST API for an online bookstore across 5 core requirements.

Verify your ability to design complete API contracts. For each requirement below, choose the proper HTTP method, URI path, and expected success status code:

1. List all books (with optional ?genre=fiction filter)
2. Get book details for ISBN #97801
3. Create a new customer order
4. Cancel/Delete an unpaid order #550
5. List items belonging to order #550
08

Architectural Recap & Best Practices

Key rules and heuristics for designing production-grade REST APIs.

Resources as Nouns
URIs name entities (/orders, /users), never actions (/getOrder, /deleteUser).
RFC 9110 Method Safety
GET, HEAD, and OPTIONS must remain safe and read-only. Never trigger mutations or deletions on GET.
Idempotent Retries
PUT and DELETE are idempotent: repeating them yields the exact same server state, allowing safe network retries.
PUT vs PATCH
Use PUT for complete resource replacement. Use PATCH for partial updates without wiping omitted fields.
Path vs Query String
Paths identify resources (/users/42). Query strings filter and paginate (?limit=10&sort=date).
Avoid Deep Nesting
Cap nested sub-resources at 1-2 levels. Entities with unique IDs should live on top-level resource roots.

The 5 Golden Rules of REST API Design

RULE 01
URIs are Nouns

Model endpoints around resources (/courses, /users). Never embed action verbs like /createCourse or /deleteUser into paths.

RULE 02
Respect Method Safety

GET must remain strictly read-only with zero mutations. Never trigger destructive side effects through query strings on GET.

RULE 03
PUT vs PATCH Precision

Use PUT exclusively for complete replacement of a representation. Use PATCH when applying a partial set of field modifications.

RULE 04
Path vs Query Separation

Use URL paths to identify specific entities (/orders/101). Use query parameters for filtering, sorting, and pagination.

RULE 05
Flat Resource Hierarchies

Avoid brittle 3+ level deep nesting. If an entity has a unique identifier, expose it directly on a top-level root endpoint.

09

REST API Design Mastery Quiz

Test your understanding of REST architectural constraints, RFC 9110 method semantics, and URL design conventions.

Question 1 of 7Score: 0
According to Roy Fielding's architectural definition, what is REST fundamentally?
A JavaScript library and standard specification for building Express servers.
An architectural style for distributed hypermedia systems defined by a set of guiding constraints (uniform interface, statelessness, client-server, cacheability, layered system).
A strict rule that every HTTP endpoint must return JSON payloads and use plural nouns.
A database query language that replaces SQL for RESTful services.
0 / 7 Answered
Next Up in APIs & Authentication
CRUD APIs — Implementation & Database Integration
Continue to CRUD APIs