RestTemplate Kullanımı

Get isteği için;

    RestTemplate restTemplate = new RestTemplate();

    MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();

    headers.add("Content-Type", "application/json");
    HttpEntity entity = new HttpEntity(headers);

    ResponseEntity<Object> response = restTemplate.exchange(API_URL, HttpMethod.GET, entity, Object.class);

Post isteği için;

restTemplate.postForObject(API_URL, requestDto, Response.class);

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

This site uses Akismet to reduce spam. Learn how your comment data is processed.