I am using Spring REST Template to call an external public REST API. As part of the API authentication I need send the user-key in the header. I am not sure how to set the custom header attribute in Spring REST template GET call.
RestTemplate restTemplate = new RestTemplate();
<Class> object = restTemplate.getForObject("<url>","<class type>");
I found this can be done with HttpHeaders class by setting set("key","value") but didn't find any concrete example. Let me know if you have any info.