• 일반적으로 두 가지 방법을 사용한다.
http://localhost:8080/api/foos?id=1,2,3
http://localhost:8080/api/foos?id=1&id=2
  • 위의 두 예시모두 Spring MVC에서 자동으로 매핑시켜주기 때문에 걱정없이 사용할 수 있다.
@GetMapping("/api/foos")
@ResponseBody
public String getFoos(@RequestParam List<String> id) {
    return "IDs are " + id;
}

참고 자료

https://stackoverflow.com/questions/2602043/rest-api-best-practice-how-to-accept-list-of-parameter-values-as-input