What is the difference between a "Collection" resource and an "Instance" resource?
Last updated
A collection resource represents a group of items (e.g. all users), while an instance resource represents a single member of that group (e.g. one specific user).
Collection resource:
URI is typically a plural noun:
/users.GETlists/filters members;POSTcreates a new member (server assigns its ID).
Instance resource:
URI adds an identifier:
/users/7.GETreads it;PUT/PATCHupdates it;DELETEremoves it.
Method semantics differ by type:
POSTto a collection creates;PUTto an instance replaces. Don'tPOSTto an instance to create children unless that instance is itself a sub-collection (/users/7/orders).