Home > Back-end >  Postman is unable to read last digit of URL
Postman is unable to read last digit of URL

Time:12-27

@RequestMapping(value = "base/limit/{sysId}/{startDate}/{endDate}?{limitIds}", 
                method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
        public Object getLimitIds(
                @PathVariable String baseId,
                @PathVariable String startDate, 
                @PathVariable String endDate,
                @RequestParam(required=false) String limitIds )

example : GET : http://localhost:8080/base/limit/fab41439/2022-11-22-02:09:11/2022-12-22-02:09:35?limitIds=23,45,56

When I print endDate I get below this missing last digit 5 "endDate 2022-12-01-02:09:3"

expected : 2022-12-22-02:09:35

Actually prints : endDate 2022-12-01-02:09:3

I tried all possible ways restart, clean build,DateFormat nothing worked.

CodePudding user response:

You had baseId as a pathVariable but it does not exists so i change it to sysId because its the only one missing

the url used

http://localhost:8080/base/limit/fab41439/2022-11-22-02:09:11/2022-12-22-02:09:35?limitIds=23,45,56

the method is void for testing you can change to whatever you want it to return

@GetMapping("/base/limit/{sysId}/{startDate}/{endDate}")
public void getLimitIds(
        @PathVariable String sysId,
        @PathVariable String startDate,
        @PathVariable String endDate,
        @RequestParam(required=false) String limitIds){

    System.out.println(sysId);
    System.out.println(startDate);
    System.out.println(endDate);
    System.out.println(limitIds);
}

print result

fab41439
2022-11-22-02:09:11
2022-12-22-02:09:35
23,45,56
  • Related