Tweeted twitter.com/StackSoftEng/status/1156897488978239489
2 edited title
| link

REST API Structure to request multiple items

1
source | link

REST API Structure

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