We have a resource collection for products: /products
.
We want to filter this collection to only return the members which have one of a list of specific class
id
's. For example:
GET /products?classes=100,101,102
This should return a collection of product members which have any of the classes listed.
The issue we have, is that we're working with thousands of products and classes, so the class list of id
's could be thousands long - too long for a query string.
I'm keen to stick to RESTful principles whenever we can, so I like the fact that the resource /products?classes=100,101,102
when called with GET
returns a filtered products collection.
Obviously, we could include the id
's list in the body in JSON format, but that would mean that the call GET /products
won't return a representation of the state of the resource (the resource being the URL), because the body is being used to provide filter options.
What's the best way to request a collection which is filtered, but the filter options are too long to use the query string..?