A resource URI should read like a noun-based path to a thing, not an action. The HTTP method already supplies the verb, so the URI just needs to identify the resource clearly and consistently.
A resource URI should read like a noun-based path to a thing, not an action. The HTTP method already supplies the verb, so the URI just needs to identify the resource clearly and consistently.
GET /users/42 — not GET /getUser?id=42. The method (GET) is the verb./users is the collection; /users/42 is one member. Staying plural everywhere keeps it predictable./users/42/orders = "orders belonging to user 42".kebab-case, lowercase. /blog-posts, not /blogPosts or /Blog_Posts./users?role=admin&sort=-created_at./users collection of users
/users/42 a single user
/users/42/orders orders belonging to user 42 (sub-collection)
/users/42/orders/1001 a specific order of that user
/orders/1001 same order, addressable at top level too
GET /users/42/orders?status=shipped&sort=-created_at&page=2 HTTP/1.1
Accept: application/json
Avoid deep nesting beyond one or two levels — /users/42/orders/1001/items/5/reviews becomes brittle. Once an order has its own ID, prefer /orders/1001. For actions that don't fit CRUD (e.g. "send email"), a controller-style sub-resource is acceptable: POST /users/42/verify-email.
Consistent naming is what makes an API feel intuitive — a developer who has seen /users and /users/42 can correctly guess /products and /products/99 without reading docs. Interviewers use this to gauge whether you think in resources (the REST mindset) rather than RPC calls (/doThisThing). The most common anti-patterns — verbs in the path, inconsistent pluralization, and deeply nested URLs — all make an API harder to learn and maintain, and they signal a developer who hasn't internalized REST's uniform-interface constraint. Good URI design also keeps concerns separated: identity in the path, filtering and pagination in the query string, which keeps caching and routing clean.
A library of IT interview questions with detailed answers — from Junior to Senior.
Donate