public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "schedule/{repo}")] HttpRequest req, string repo, ILogger log) { DateTime startDate, endDate; StringValues startBuffer, endBuffer; log.LogInformation("Schedule(): Received request"); if (req.Query.TryGetValue("startdate", out startBuffer) && req.Query.TryGetValue("enddate", out endBuffer)) { if (!DateTime.TryParse(startBuffer, out startDate) || !DateTime.TryParse(endBuffer, out endDate)) { log.LogError("Schedule(): Badly formed dates in query string"); return(new BadRequestResult()); } } else { // Dates were not provided, use default of next 31 days startDate = DateTime.Today; endDate = DateTime.Today.AddDays(31); } var result = await ScheduleData.GetScheduleAsync(repo, startDate, endDate); return(new OkObjectResult(result)); }