I need to find the entries between a date range and would like to make a GET call in the Spring Boot API as follow,
$ curl -X GET http://localhost:8080/api/v1/appointments/findWithRange?start=2018-10-01&end=2018-10-15
I write the GET call,
@GetMapping("/findWithRange")
public ResponseEntity<List<Appointment>> findAllWithCreationRange(@RequestParam("start") Date start, @RequestParam("end") Date end) {
List<Appointment> appointments = service.findAllWithCreationRange(start, end);
if (Objects.isNull(appointments)) {
ResponseEntity.badRequest().build();
}
return ResponseEntity.ok(appointments);
}
I get the return response,
{"timestamp":"2019-02-10T07:58:22.151+0000","status":400,"error":"Bad Request","message":"Required Date parameter 'end' is not present","path":"/api/v1/appointments/findWithRange"}
How do I write the call properly? It seems I was not been able to debug as the breakpoints don't catch.