How to differentiate endpoints based on parameters?
I want to have two endpoints
/users
/users
and
/users?id=#
/users?id=#
, but swagger doesn't seem to like what I have now. I really don't want to have to make an endpoint just because it can't differentiate between the two. Tips would be appreciated.
// GET - "https://localhost:7229/api/users" [HttpGet] public async Task<IActionResult> GetAllUsers(); // GET - "https://localhost:7229/api/users?=#" [HttpGet] public async Task<IActionResult> GetUserById([FromQuery] int id);
// GET - "https://localhost:7229/api/users" [HttpGet] public async Task<IActionResult> GetAllUsers(); // GET - "https://localhost:7229/api/users?=#" [HttpGet] public async Task<IActionResult> GetUserById([FromQuery] int id);