I have a REST API with GETs operations which receive a (long) list of parameters (8 parameters, for example). The aim of this operation is to search and filter elements.
Which is the best practice to manage this scenario?:
(1) Receive a list of parameters?:
public ResultType Get(int p1, int p2, string p3...) { ... }
(2) Or receive an object that encapsulate these parameters?:
public class MyClass
{
public int X { get; set; }
public int Y { get; set; }
public string Z { get; set; }
}
public ResultType Get(MyClass parameter) { ... }
Think in an eCommerce scenario in which you want to search and filter "products" by name, description, category, brand, model, price, etc...