The GET Request contains a JSON Payload similar to below : { "customeId" : "A123", "Status" : "Assigned", "StartDate" : "2020-07-18", "EndDate" : "2020-07-20", "FetchLimit" : "10" } Am using multi-value map to add these inputs along with Headers (Content-type,Accept,Co-relation ID). The same request payload is providing the response thru Postman, but when I make a GET call using RestTemplate.exchange(URL, HttpMethod.Get ,entity, Response.class) am receiving Response as 308 PERMANENT REDIRECT. Any thoughts towards resolution would be great ! TIA ###Code Snip Below####
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Accept",MediaType.APPLICATION_JSON_VALUE);
headers.set("Correlation-ID","1234");
MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>();
map.add("customerId","A123");
map.add("status","Assigned");
map.add("StartDate","2020-07-18");
map.add("EndDate","2020-07-19");
map.add("FetchLimit","10");
String urlString = "http://dev-editest.com/cust/v1/retreiveById"
HttpEntity<?> request = new HttpEntity<>(map, headers);
ResponseEntity<User> response = restTemplate.exchange(urlString, HttpMethod.GET, request, User.class);