0
@Path("/submit")
public List<SaveCResponse> submitC(List<Long> ids) {

    ICService cService = CServiceBootstrap.getCService();
    List<SaveCResponse> cResponses = new ArrayList<>();
    for (Long id : ids) {
        SaveCResponse cResponse = cService.reSubmitC(id);
        cResponses.add(cResponse);
    }
    return cResponses;

}

How to call the above method using postman. I mean how to pass list of IDs ?

daniu
  • 14,137
  • 4
  • 32
  • 53
SVK
  • 21
  • 3
  • If I'm not mistaken you can just send them as an array in your JSON object. Possible duplicate : https://stackoverflow.com/questions/15099167/sending-list-in-json-request – DaveCat May 14 '19 at 18:54
  • passed data as 'ids' : [123] got a error message saying : Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@1d5c835; line: 1, column: 2] @DaveCat – SVK May 14 '19 at 18:59
  • Broseph, that does not look like valid JSON to me. Try: { "ids": "[123]" } See if that does any better? @SVK – DaveCat May 14 '19 at 19:24
  • Try `/submit?ids=1&ids=2&ids=3` – Nikolai Shevchenko May 14 '19 at 19:51
  • @DaveCat, I tried that as well. I am seeing the same error. Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@55e0dbf0; line: 1, column: 1] – SVK May 14 '19 at 20:31
  • @NikolayShevchenko, No Luck. I am seeing Bad Request error. – SVK May 14 '19 at 20:31
  • @SVK Something sounds fishy about this. I did Google the error you posted and it lead me to someone having a similar problem. Their problem was basically like I was thinking in your case ( their JSON was jacked up because they were trying to pass in a collection). I'd say take a look there and see if you can emulate the solution to their problem : https://stackoverflow.com/questions/20837856/can-not-deserialize-instance-of-java-util-arraylist-out-of-start-object-token – DaveCat May 15 '19 at 13:29

0 Answers0