Not able to post Array of string ids to Spring mvc controller using curl as it is throwing 400
status.
Controller Method:
@RequestMapping(value="/evidencesbyIds",method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> getEvidenceByIds(@RequestBody String[] ids){
// body here
}
CURL Commands:
curl -H "Content-type: application/json" -X POST -d '{"ids":["1","2"]}' http://localhost:8080/vt/evidencesbyIds
curl -H "Content-type: application/json" -X POST -d "{"ids":["1","2"]}" http://localhost:8080/vt/evidencesbyIds
curl -H "Content-type: application/json" -X POST -d "{"ids":[\"1\",\"2\"]}" http://localhost:8080/vt/evidencesbyIds
curl -H "Content-type: application/json" -X POST -d "{\"ids\":[\"1\",\"2\"]}" http://localhost:8080/vt/evidencesbyIds
I tried multiple times to execute curl commands but they are throwing status as 400 and exception as
"Can not deserialize instance of java.lang.String[] out of START_OBJECT token\n at"