What is the best way to design a RESTful resource for an object with a composite id? For example, suppose I have a GET /people resource for getting a list of person records. A person doesn't have a single id; instead, it is identified by firstName, lastName, and birthdate. How should I design the resource to get a single person?
3 Answers
As already mentioned in the comments, if you don't have a single identifier that ensure uniqueness, you could consider matrix variables:
GET /people;firstname=John;lastname=Smith;birthday=1973-12-01
firstName,lastNameandbirthdayis guaranteed to create a unique identifier, you could also use a matrix-parameter:GET /people;firstName=John;lastName=Smith;birthday=1973-12-01