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)
3
  • Below URIs are not working: "/alertguids/"+"WestClipNext,Master"+ "?productId=" + PRODUCT; "/alertguids/"+"[WestClipNext,Master]"+ "?productId=" + PRODUCT; Commented Nov 4, 2016 at 7:58
  • Just use comma seperated values and get rid of brackets: /alertguids/WestClipNext,Master?productId=" + PRODUCT Commented Nov 4, 2016 at 8: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. Commented Nov 4, 2016 at 8:11

1 Answer 1

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.