REST URI Design Interview Questions and Answers
Master REST URI Design with the top 15 interview questions and answers. Learn URI vs URL, resource naming conventions, nested resources, query parameters, pagination, filtering, versioning, Spring Boot examples, production best practices, and common interview questions.
Introduction
A well-designed URI (Uniform Resource Identifier) is the foundation of every REST API. Clean, consistent, and meaningful URIs make APIs easy to understand, maintain, and integrate with. Poor URI design leads to confusing APIs, inconsistent implementations, and poor developer experience.
Interviewers frequently ask questions about URI naming conventions, URI vs URL, nested resources, query parameters, pagination, filtering, versioning, and REST resource design.
In this guide, you'll learn the 15 most important REST URI Design interview questions with production-ready explanations, Spring Boot examples, architecture diagrams, best practices, common mistakes, and interview follow-up questions.
What You'll Learn
After completing this guide, you'll be able to:
- Design clean REST URIs.
- Understand URI vs URL vs URN.
- Follow industry naming conventions.
- Design nested resources.
- Implement pagination and filtering.
- Version REST APIs correctly.
- Answer REST API design interview questions confidently.
REST URI Design Overview
REST URI Design
Client
│
HTTP Request
│
GET /employees/101/orders
│
▼
Spring Boot API
│
▼
Database
│
▼
JSON Response
1. What is a URI?
Short Answer
A URI (Uniform Resource Identifier) uniquely identifies a resource in a REST API.
Example
/employees
/products
/orders/101
/customers/500
Each URI represents a resource rather than an action.
Production Example
GET /customers/1001
Returns customer information.
Interview Follow-up
Can two different resources have the same URI?
Answer: No.
2. What is the Difference Between URI and URL?
Short Answer
A URL is a type of URI that specifies both the resource and how to access it.
| URI | URL |
|---|---|
| Identifies Resource | Identifies + Locates Resource |
| Broader Concept | Subset of URI |
| May not include protocol | Includes protocol |
Example
URI
/employees/100
URL
https://api.company.com/employees/100
Common Mistakes
Using URI and URL interchangeably in interviews.
3. What are REST URI Naming Conventions?
Best Practices
- Use nouns.
- Use lowercase letters.
- Use hyphens.
- Avoid spaces.
- Keep URIs readable.
- Avoid file extensions.
Good
/employees
/customer-orders
/payment-history
Bad
/GetEmployee
/createCustomer
/deleteOrder
Interview Tip
Always design URIs as resources.
4. Why Should REST URIs Use Nouns Instead of Verbs?
Short Answer
HTTP methods already define the action.
The URI should represent the resource.
Correct
GET /employees
POST /employees
Incorrect
GET /getEmployees
POST /createEmployee
Production Example
GitHub API
GET /users
Stripe API
POST /payments
5. Should Resources be Singular or Plural?
Best Practice
Use plural resource names.
Good
/employees
/orders
/customers
Bad
/employee
/order
/customer
Why?
Collections naturally use plural names.
6. What are Nested Resources?
Short Answer
Nested resources represent relationships between resources.
Example
/customers/100/orders
/orders/200/items
/employees/50/projects
Internal Structure
Customer
│
├── Orders
│ ├── Order 1
│ ├── Order 2
│
└── Addresses
Production Example
Amazon
GET /customers/500/orders
7. How Should Query Parameters be Used?
Purpose
Query parameters filter or modify results.
Examples
Filtering
GET /employees?department=IT
Sorting
GET /employees?sort=name
Searching
GET /employees?name=John
Common Mistakes
Using query parameters for resource identification.
Incorrect
/employee?id=10
Better
/employees/10
8. How is Pagination Implemented?
Production Example
GET /employees?page=1&size=20
Response
20 Employees
Spring Boot Example
@GetMapping
public Page<Employee> employees(
Pageable pageable){
return repository.findAll(pageable);
}
Benefits
- Better performance
- Smaller payloads
- Faster responses
9. How are Filtering and Sorting Implemented?
Filtering
GET /products?category=Laptop
Sorting
GET /products?sort=price
Multiple Filters
GET /products?category=Laptop&brand=Apple
Production Example
E-commerce websites.
10. How Should API Versioning be Designed?
URI Versioning
/v1/customers
/v2/customers
Header Versioning
Accept:
application/vnd.company.v2+json
Best Practice
URI versioning is the simplest and most commonly used.
11. What Characters Should be Used in URIs?
Recommended
- Lowercase
- Hyphen (-)
- Numbers
- Forward Slash
Good
/employee-address
/order-history
Bad
/EmployeeAddress
/order_history
/Employee Address
12. What are Common URI Design Mistakes?
- Using verbs.
- Mixing singular and plural names.
- Uppercase letters.
- Exposing database table names.
- Long URIs.
- Deep nesting.
- Using spaces.
- Including implementation details.
Example
Bad
/employeeTable/getEmployeeById
Good
/employees/101
13. How are URIs Designed in Enterprise Applications?
Example Banking API
GET /accounts
GET /accounts/100
POST /accounts
PUT /accounts/100
DELETE /accounts/100
Architecture
Client
↓
API Gateway
↓
Spring Boot
↓
Business Service
↓
Database
14. Design a REST URI for an Online Shopping Application
Resources
/products
/categories
/orders
/payments
/cart
/users
Nested Resources
/users/101/orders
/orders/500/items
/products/100/reviews
Filtering
/products?brand=Apple
/products?price=1000
/products?category=Laptop
Pagination
/products?page=2&size=25
15. What are REST URI Design Best Practices?
- Use nouns instead of verbs.
- Use plural resource names.
- Keep URIs simple.
- Use lowercase letters.
- Use hyphens instead of underscores.
- Use HTTP methods for actions.
- Use query parameters for filtering.
- Support pagination.
- Keep URI hierarchy meaningful.
- Version APIs consistently.
URI Design Summary
| Design Principle | Recommendation |
|---|---|
| Resource Naming | Nouns |
| Resource Collection | Plural |
| Case | Lowercase |
| Word Separator | Hyphen (-) |
| Filtering | Query Parameters |
| Pagination | page & size |
| Sorting | sort Parameter |
| Versioning | /v1/, /v2/ |
| Resource Identification | Path Variables |
| Actions | HTTP Methods |
Interview Tips
When answering URI Design questions:
- Explain that URIs identify resources.
- Differentiate URI and URL.
- Use nouns instead of verbs.
- Prefer plural resource names.
- Explain nested resources.
- Demonstrate filtering and pagination.
- Discuss API versioning strategies.
- Mention Spring Boot path variables and query parameters.
- Avoid exposing implementation details.
- Use real-world API examples.
Key Takeaways
- URIs uniquely identify REST resources.
- REST URIs should represent resources, not actions.
- Use nouns, plural names, lowercase letters, and hyphens.
- Path variables identify resources, while query parameters filter and sort data.
- Nested resources represent relationships between entities.
- Pagination improves performance for large datasets.
- API versioning ensures backward compatibility.
- Clean URI design improves readability, maintainability, and developer experience.
- Well-designed URIs are a hallmark of production-ready REST APIs.
- URI design is one of the most frequently tested topics in REST API interviews.