pwillt
pwillt
CC#
Created by Manson on 1/17/2023 in #help
How to differentiate endpoints based on parameters?
This is more of a problem with http standards, your trying to use /users for a single and multi result endpoints. I'm wondering why your not using /users and /user. If you really want to use /users for both you could use the same method: [HttpGet] [Route("/users")] public object[] get(string email, string password) { if (string.IsNullOrWhiteSpace(email) && string.IsNullOrWhiteSpace(password)) { return new object[1]; } else { return new object[0]; } }
5 replies