I am currently writing a webservice providing access to some resources. I try to follow REST but I am facing a problem concerning some parts of my API.
I have the follwing uris:
- /myservice/users/ : to get all users
- /myservice/users/{userId} : to get a specific user
- /myservice/badges/ : to get all badges
- /myservice/badges/{badgeId} : to get a specific badge
Now, my problem is, i have to implement a way to get all users that have a particular badge. I can consider that this is just a filter I apply on the list of users, hence the following uri:
- /myservice/users/?filter=badge:{badgeId}
Or I can consider that this is just a sub-resources of a badge, hence the following uri:
- /myservice/badges/{badgeId}/users/
Which one seems the must 'REST-compliant' ?
I must say I have read some posts on this subject specifically this one: Rest Standard: Path parameters or Request parameters but they don't seem to cover my problem.