Why do REST APIs usually use plural resource names?
Plural resource names represent collections of items, making it clear that the endpoint deals with multiple resources, like /users for many users.
Click to reveal answer
beginner
What does a singular resource name usually represent in REST APIs?
A singular resource name often represents a single item or entity, typically used in the URL when accessing or modifying one specific resource, like /users/123.
Click to reveal answer
beginner
Which is the recommended way to name a resource collection endpoint: /book or /books?
The recommended way is /books because it clearly indicates a collection of book resources.
Click to reveal answer
beginner
How would you name an endpoint to get a single user by ID?
Use the plural resource name followed by the ID, like /users/123, to indicate you want one user from the users collection.
Click to reveal answer
intermediate
Is it okay to mix singular and plural resource names in the same API?
It is best to be consistent and use plural names for collections and singular only when referring to a single resource by ID. Mixing can confuse users and developers.
Click to reveal answer
Which URL is best for accessing all products in a REST API?
A/products
B/product
C/getProducts
D/allproducts
✗ Incorrect
Using the plural noun /products clearly indicates a collection of product resources.
How should you name the endpoint to update a single order with ID 45?
A/order/45
B/orders/update/45
C/orders/45
D/updateOrder/45
✗ Incorrect
Use the plural resource name with the ID: /orders/45 to target one order.
Why avoid using singular resource names for collection endpoints?
AThey confuse the meaning of the endpoint
BThey require more server memory
CThey are slower to load
DThey are harder to type
✗ Incorrect
Singular names suggest a single item, so using them for collections can confuse users about what the endpoint returns.
Which is the best practice for REST API resource naming?
AUse uppercase letters in URLs
BUse singular for all endpoints
CUse verbs in resource names
DUse plural for collections and singular for single items
✗ Incorrect
Plural names for collections and singular for single items keep the API clear and consistent.
What does the URL /users/789 typically represent?
AA collection of users
BA single user with ID 789
CA search for users
DAn error page
✗ Incorrect
The plural users followed by an ID usually means one user resource.
Explain why REST APIs prefer plural resource names for collections and how singular names are used.
Think about how you talk about groups vs. one item in real life.
You got /3 concepts.
Describe the potential confusion if singular resource names are used for collections in REST APIs.
Imagine asking for 'book' but getting many books instead.
You got /3 concepts.
Practice
(1/5)
1. Which naming style is recommended for an API endpoint that returns a list of users? /user or /users?
easy
A. /users because it is singular and more precise.
B. /user because it is shorter and simpler.
C. /user because it is singular and more precise.
D. /users because it represents multiple users.
Solution
Step 1: Understand resource naming for collections
API endpoints returning multiple items should use plural names to clearly indicate a list.
Step 2: Apply naming to the example
Since the endpoint returns multiple users, /users is the correct plural form.
Final Answer:
/users because it represents multiple users. -> Option D
Quick Check:
Plural for lists = /users [OK]
Hint: Use plural names for endpoints returning lists [OK]
Common Mistakes:
Using singular for list endpoints
Confusing singular and plural forms
Choosing shorter names over clarity
2. Which of the following is the correct endpoint to access a single product by its ID?
easy
A. /products/123
B. /product/123
C. /products
D. /product
Solution
Step 1: Identify singular vs plural for single item access
When accessing a single item by ID, use the plural form of the resource name followed by the ID.
Step 2: Match the correct endpoint format
The endpoint /products/123 uses plural products and includes the ID, which is the common RESTful convention.
Final Answer:
/products/123 -> Option A
Quick Check:
Single item access = plural + ID [OK]
Hint: Use plural resource name when accessing one item by ID [OK]
Common Mistakes:
Using singular resource name for single item
Omitting the ID when accessing a single item
Mixing singular/plural inconsistently
3. Given the following API endpoints, which one correctly retrieves a list of orders?
GET /order GET /orders GET /order/456 GET /orders/456
medium
A. GET /order
B. GET /orders/456
C. GET /orders
D. GET /order/456
Solution
Step 1: Identify endpoints returning lists
Endpoints returning lists should use plural resource names without an ID.
Step 2: Analyze each option
GET /orders uses plural and no ID, so it returns the list of orders. Others either use singular or include an ID, indicating single item access.
Final Answer:
GET /orders -> Option C
Quick Check:
List retrieval = plural resource without ID [OK]
Hint: Plural + no ID means list retrieval [OK]
Common Mistakes:
Choosing singular endpoint for list
Confusing ID presence with list retrieval
Ignoring plural vs singular rules
4. You have an API endpoint defined as GET /users/ to get a list of users and GET /user/{id} to get a single user. A developer mistakenly uses GET /user/ to get all users. What is the likely problem?
medium
A. The endpoint /user/ is incorrect for list retrieval and may cause a 404 error.
B. The endpoint /user/ will return a list of users anyway.
C. The endpoint /user/ will return a single user without ID.
D. The endpoint /user/ will automatically redirect to /users/.
Solution
Step 1: Understand endpoint naming conventions
List retrieval requires plural resource name, so /users/ is correct for all users.
Step 2: Analyze the incorrect usage
/user/ is singular and without an ID, so it likely does not exist or returns an error like 404.
Final Answer:
The endpoint /user/ is incorrect for list retrieval and may cause a 404 error. -> Option A
Quick Check:
Singular without ID ≠ list endpoint [OK]
Hint: Singular without ID usually causes errors for list requests [OK]
Common Mistakes:
Using singular endpoint for list retrieval
Assuming singular endpoint returns list
Expecting automatic redirects between endpoints
5. You are designing an API for a library system. Which of the following endpoint designs correctly follows the plural vs singular resource naming best practices for retrieving a single book and all books?
hard
A. GET /book for all books and GET /books/{id} for a single book
B. GET /books for all books and GET /book/{id} for a single book
C. GET /books/{id} for all books and GET /book for a single book
D. GET /book/{id} for all books and GET /books for a single book
Solution
Step 1: Recall naming rules for collections and single items
Use plural resource names for collections (all books) and singular for single items by ID.
Step 2: Match options to rules
GET /books correctly retrieves all books (plural). GET /book/{id} correctly retrieves a single book (singular with ID).
Final Answer:
GET /books for all books and GET /book/{id} for a single book -> Option B
Quick Check:
Plural for list, singular + ID for single [OK]
Hint: Plural for lists, singular + ID for single items [OK]
Common Mistakes:
Swapping singular and plural for list vs single
Using singular without ID for list
Using plural with ID for single item
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.