What is the difference between a collection resource and a singleton resource?
Answer
A collection resource represents a group of resources of the same type and is addressed by a plural noun URL: /users. A GET request returns a list; POST creates a new item in the collection. A singleton resource represents a single, unique resource — either a specific item (/users/42) or a conceptually single entity (/account/settings for the currently authenticated user's settings). For singletons that are contextually unique, avoid requiring an ID: GET /me returns the current user's profile without needing to know the ID. The collection/singleton distinction maps cleanly to database table (collection) vs row (singleton) concepts and helps clients intuitively understand the API structure.
Previous
What is a base URL and how should it be structured?
Next
What is content negotiation in REST APIs?
More REST API Design Questions
View all →- Beginner What is REST and what are its six architectural constraints?
- Beginner What are the main HTTP methods used in REST APIs and what do they do?
- Beginner What is idempotency and which HTTP methods are idempotent?
- Beginner What are the most important HTTP status codes in REST APIs?
- Beginner What are REST resource naming conventions?