I have a REST API that looks something like the below where a person can belong to an organisation (but doesn't have to) and a person has many items. The items may also belong to the organisation instead of the person.
/people/:personId
/people/:personId/items
/organisations/:orgId/items
/organisations/:orgId/people/:personId/items
There is a scenario where we want to query the items for multiple people within an organisation, what's the correct URL structure to use?
Option 1
/organisations/:orgId/people/items?personId=1&personId=2
Option 2
/organisations/:orgId/items?personId=1&personId=2
Option 3
/items?personId=1&personId=2
Best Answer
It really doesn't matter that much. Your URL is just a 'unique resource locator' the format you use is up to you. Go with what you are most confortable with and your users will understand.
Having said that I'd go with
?personId=1&personid=2
just because its easy to parse/readtake a look at this similar question