Hi everyone,
I have a resource with multiple unique identifier
For example /dogs, with id, name and dna is unique.
how should a RESTful design for get one id, name and dna looks like?
Some of my thought:
1. Using query string:
/dogs/{id}
/dogs?name={name}
/dogs?dna={dna}
This is not consistent, where /dogs/{id} return a single entity, the others return a collection (of one)
2. use a type parameter
/dogs/{id}?type={id|name|dna}
the type if not provided will be "id" by default.
this make it consistent, all return single entity if found and 404 if not found.
3. sub resource
/dogs/{id}
/dogs/name/{name}
/dogs/dna/{dna}
hmm, not RESTful ?
Thank you