Lets say I have an Organization and Users inside that organization. To get a user in particular organization what should be the GET request url from below options?

1. /api/organization/:orgId/users/:userId
2. /api/users/:userId?organizationId=orgId

Any other suggestions are welcome.

  • I vote for the first. Much more readable. Apr 4, 2016 at 21:55

1 Answer 1


Best to map onto what semantics you are trying to convey.


This reads to me as there being a bunch of organizations, and for each organization, you have a bunch of users, and you want to get information for that user.


This reads to me as there being a bunch of users, and each user may belong to a bunch of organizations, and you are asking for the user's information in the context of that organization.

If it helps, here's the sort of situation where I'd use a query parameter:


Since "language" just controls how the data is presented, not what it is, it makes sense to make it a parameter, not part of the data model.

Now I can't say for sure how to handle your data, as I don't know for sure what "Organization" actually is, but if it is a situation similar to what I described for the first option, that's the way I'd go.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.