skip to Main Content

URLs ignore arguments in GET request (ASP.NET)

I need to write a Web API for this request: {apiUrl}/api/sessions/byhour?startTime=2021-06-30T01:00:00&endTime=2021-06-30T03:00:00 So I have this controller and method: [ApiController] [Route("/api/sessions/byhour")] public class LoginStatsByHourController : ControllerBase { [HttpGet, Route("{startTime=0001-01-01T12:00:00}/{endTime=9999-12-31T11:59:59}")] public List<SessionEntry> GetSessionEntryByDate(string startTime, string endTime) {...} } I tested this request:…

VIEW QUESTION
Back To Top
Search