Recall & Review
beginner
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?
✗ 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?
✗ Incorrect
Use the plural resource name with the ID:
/orders/45 to target one order.Why avoid using singular resource names for collection endpoints?
✗ 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?
✗ Incorrect
Plural names for collections and singular for single items keep the API clear and consistent.
What does the URL
/users/789 typically represent?✗ 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.