0

I have below API to be tested. Not getting solution to pass string array to requestors. Tried with comma seperated values, values with in [] etc.

@RequestMapping(value = "/v10/{user}/alerts/alertguids/{requestors}", method = RequestMethod.GET)
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public String[] retrieveRunnableAlertGuidsByRequestors(@RequestParam(value = "productId") final String productId,
                                                           @PathVariable final String[] requestors)
DimaSan
  • 12,264
  • 11
  • 65
  • 75
Rajesh Bhat
  • 791
  • 3
  • 8
  • 20
  • Below URIs are not working: "/alertguids/"+"WestClipNext,Master"+ "?productId=" + PRODUCT; "/alertguids/"+"[WestClipNext,Master]"+ "?productId=" + PRODUCT; – Rajesh Bhat Nov 04 '16 at 07:58
  • Just use comma seperated values and get rid of brackets: `/alertguids/WestClipNext,Master?productId=" + PRODUCT` – nickmesi Nov 04 '16 at 08:09
  • @UsermujM: No, as I said in above comment, comma seperated values won't work. It considers the whole string as single value instead considering it as multiple values. – Rajesh Bhat Nov 04 '16 at 08:11

1 Answers1

1

I'm not sure with @PathVariable but you can use the @RequestParam.

eg:

@RequestMapping(value = "/v10/{user}/alerts/alertguids/{requestors}", method = RequestMethod.GET)
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public String[] retrieveRunnableAlertGuidsByRequestors(@RequestParam(value = "productId") final String productId,
                                                           @RequestParam(value = "param[]")  final String[] requestors)
Ye Win
  • 2,020
  • 14
  • 21