Untitled

 avatar
unknown
plain_text
a month ago
623 B
1
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
}
Leave a Comment