Untitled
Anonymous
plain_text
01/08/2025 10:42 AM
832 B
13
Indexable
public LocationResponse getLocationDetails(String postcode) {
String endpoint = location + "/location/details"; // Ensure this URL is correctly formed
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> requestEntity = new HttpEntity<>("{\"postcode\":\"" + postcode + "\"}", headers);
ResponseEntity<LocationResponse> responseEntity = restTemplate.exchange(endpoint, HttpMethod.POST, requestEntity, LocationResponse.class);
return responseEntity.getBody(); // Return the response body
}Editor is loading...
Leave a Comment