I need to be able to grab a collection based on a collection of objects. For this, I\'m considering a couple of approaches, but am not sure which one makes the most sense, s
Objective: We want to get the Reviews for all of the Products
Basically, GET /api/products/<id> should return a product, and GET /api/products/<id>/reviews should return all reviews for a given product.
If you want to fetch all products, you will use GET /api/products. As you consider both reviews and products as resources, I recommend you to expose all reviews:
GET /api/reviews
But you probably want products with their reviews. That would mean fetching some products using /api/products (and a set of filters for example) and expanding the result set with reviews. This expand term comes from the OData protocol: http://www.odata.org/documentation/uri-conventions#ExpandSystemQueryOption.
You could do:
GET /api/products?$expand=reviews
GET /api/products?filter=foo&$expand=reviews
This URI means: "identifies the collection of products as well as each of the reviews associated with each product.