public <T,K> K postApiCall(T t, HttpHeaders headers, String url, Class<K> resposne){
try {
RestTemplate restTemplate = new RestTemplate();
headers.add("Content-Type","application/json");
HttpEntity<T> entity = new HttpEntity<T>(t, headers);
ResponseEntity<K> result = restTemplate.exchange(url, HttpMethod.POST, entity, resposne);
System.out.println(result.getBody());
return result.getBody();
}catch (Exception ee){
ee.printStackTrace();
}
return null;
}
No comments:
Post a Comment