This is my controller:
@GetMapping("/checkMeetingRoomAvailability")
public @ResponseBody ResponseDto checkMeetingRoomAvailability(@DateTimeFormat(pattern = "dd-M-yyyy hh:mm:ss") Date begin,
@DateTimeFormat(pattern = "dd-M-yyyy hh:mm:ss") Date end, @RequestParam Integer capacity) {
return meetingRoomServiceLocal.checkMeetingRoomAvailability(begin, end, capacity);
}
When I pass input using postman its giving 400 bad request.
meetingRoomController/checkMeetingRoomAvailability?begin=30-9-2020 14:30:00&end=30-9-2020 15:30:00&capacity=10
I am unable to figure out why I am getting this error.
Either of the following solutions will work:
dd-M-yyyy hh:mm:ss
with dd-M-yyyy'T'hh:mm:ss
in the code and then you can test it like meetingRoomController/checkMeetingRoomAvailability?begin=30-9-2020T14:30:00&end=30-9-2020T15:30:00&capacity=10
.meetingRoomController/checkMeetingRoomAvailability?begin=30-9-2020 14:30:00&end=30-9-2020 15:30:00&capacity=10
using some encoding tool e.g. https://www.urlencoder.org/ and use the encoded URL in Postman. I do not recommend this as it will force your clients to encoded URL before they can send a request to your server.