[FAQ] 지도/로컬 API 문의 전 꼭 읽어 주세요.
https://devtalk.kakao.com/t/faq-api/125610
dapi.kakao.com/v2/local/search/address api를 스프링3.2 기반에서 실행하면 connection time out 이 발생합니다.
공식적으로 이 api 가 자바에서 호출 가능한가요 ?
[FAQ] 지도/로컬 API 문의 전 꼭 읽어 주세요.
https://devtalk.kakao.com/t/faq-api/125610
dapi.kakao.com/v2/local/search/address api를 스프링3.2 기반에서 실행하면 connection time out 이 발생합니다.
공식적으로 이 api 가 자바에서 호출 가능한가요 ?
My first question. Are you using Java or JS?
The Cocoa Native API is provided as a REST API and can be used with Java/Spring. The connection timeout issue you are experiencing is not a limitation of the API.
Here are my suggested solutions:
Timeout settings for RestTemplate:
@Configuration
public class RestTemplateConfig {
@Bean
public RestTemplate restTemplate() {
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
factory.setConnectTimeout(5000);
factory.setReadTimeout(5000);
return new RestTemplate(factory);
}
}
API call example:
@Value("${kakao.rest.api.key}")
private String restApiKey;
public ResponseEntity<String> searchAddress(String query) {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "KakaoAK " + restApiKey);
HttpEntity<String> entity = new HttpEntity<>(headers);
String url = "https://dapi.kakao.com/v2/local/search/address?query=" + query;
return restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
}
If the issue persists, things to check:
Whether your application key is registered correctly
Whether you have exceeded the daily API call limit (100,000 calls)
Your network environment settings
If you need more detailed support, please send a message to a DevTalk moderator with the following information
The application key you are using
The offending code snippet
The error screenshot
The development environment information