curl -v POST -d '[23,24]' https://serverurl/api/list/GetByIds --header "Accept:application/json" --header "Content-Type:application/json" --header "Authorization: Bearer XYZ" The above curl statement returns proper result. I am not sure how to send the same data using Spring RestTemplate.exchange . I don't need the whole code, I just want to know how I can send that list of integers [23,24].
RequestEntity<List<Integer>> request = RequestEntity.post(new URI("http://example.com/bar")).accept(MediaType.APPLICATION_JSON).body(<actual list here>);