This is the Url I want to call GET https://www.nseindia.com/api/holiday-master?type=trading
It is working in postman and from browser as well, but when I am trying to call this api from my code in Kotlin it is throwing Read timed out.
These are the two implementations that I tried :
@FeignClient(value = "nse", url = "\${usage.url.nseUrl}")
interface NseProxy {
@GetMapping(
value = ["/api/holiday-master?type=trading"],
)
fun getHolidayMaster(): NseHolidayMasterResponse
}
and ,
RestTemplate().getForEntity("https://www.nseindia.com/api/holiday-master?type=trading", NseHolidayMasterResponse::class.java)
After reading that some basic headers are also required, I tried :
@FeignClient(value = "nse", url = "\${usage.url.nseUrl}")
interface NseProxy {
@GetMapping(
value = ["/api/holiday-master?type=trading"],
)
@Headers(
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Safari/537.36"
)
fun getHolidayMaster(): NseHolidayMasterResponse
}