当我使用RestTemplate时,我收到400错误的请求,但是当我使用邮递员客户端时,下面的响应是我的代码示例:
String url = "https://fastaglogin.icicibank.com/ISRCUSTAPI/Customer/GetTransactionDetails";
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.set("APIClient_ID", "1*******9");
headers.set("API_KEY", "AE90****************89");
headers.setContentType(MediaType.APPLICATION_JSON);
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
map.add("CustomerId", "10******59");
map.add("VehicleNumber", "KA51AA6117");
map.add("StartTransactionDate", "2018-10-01");
map.add("EndTransactionDate", "2018-10-16");
final HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<MultiValueMap<String, String>>(map ,
headers);
ResponseEntity<String> result = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);