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?
I would use one of the following variations:
GET /people/John/Smith/1973-12-01
or
GET /people/John,Smith,1973-12-01
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With