We have some entities that have both a unique business id (e.g. "my-unique-name") and also have an internal UUID (e.g. aa54-342-dffdf-55445-effab). Whats is a good way to provide a REST URI that can return the resource using either method.
Approach 1 - have two resource URLs (ugly!!!):
/foo-by-id/my-unique-name
/foo-by-uuid/aa54-342-dffdf-55445-effab
Approach 2 - always use a query parameter (even though it returns a single item...seems un-rest-lke)
/foo?id=my-unique-name
/foo?uuid=aa54-342-dffdf-55445-effab
Approach 3 - have the web service figure out whether the {id} is a UUID or not (this could get error prone, but in all likihood would work just fine...
Approach 4 - use the UUID, allow business id as a query parameter (don't know if this would work)
/foo?id=my-unique-name
/foo/aa54-342-dffdf-55445-effab
Any thoughts are appreciated.