Im trying to create a GET request that can handle few optional searching/filter params.
The request should look like:
https://localhost:99999/api/computers?ModelName=asus&RAM=2&ScreenSize=22
or
https://localhost:99999/api/computers?ModelName=asus&RAM=2
or
https://localhost:99999/api/computers?RAM=2&ScreenSize=22
or
https://localhost:99999/api/computers
The point is that it can have multiple optional params like: ModelName, RAM, ScreenSize or just RAM, ScreenSize or ModelName, RAM or empty.
The conroller looks like:
[HttpGet]
public IHttpActionResult GetComupters(string ModelName, int? RAM, int? ScreenSize)
{
return Ok();
}
How should i build the RouteTemplate for this type of search\filtering?
Thanks!!!