안녕하세요.
궁금한게있습니다.
@GetMapping(value = "/search/kakao", produces = "application/json; charset=UTF-8")
@ResponseBody
public ResponseEntity<String> kakaoSearchList(String query,
String latitude,
String longitude,
String radius) {
URI uri = null;
uri = UriComponentsBuilder
.fromUriString(kakaoApiUrl)
.queryParam("query", query)
.queryParam("x", longitude)
.queryParam("y", latitude)
.queryParam("radius", radius) // 반경 2km
.build(false)
.toUri();
WebClient webClient = WebClient.builder()
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.defaultHeader("Accept", "*/*")
.defaultHeader("Authorization", "KakaoAK " + kakaoApiKey)
.build();
ResponseEntity<String> responseEntity = webClient.get()
.uri(uri)
.retrieve()
.toEntity(String.class)
.block();
return ResponseEntity.ok(responseEntity.getBody());
}
이렇게 했는데 왜 200을 받는데, 데이터는 아무것도없을까요?
동일한 기준으로 postman에서는 데이터가 나오는데, 왜 java에서 쏘면 안나오는지 모르겠습니다.
변수들은 동일한 값들을 던져주고있습니다.
https://dapi.kakao.com/v2/local/search/keyword.json?query=음식점&x=127.375039&y=36.367537&radius=300
<200,{“documents”:,“meta”:{“is_end”:true,“pageable_count”:0,“same_name”:{“keyword”:“ììì ”,“region”:,“selected_region”:“”},“total_count”:0}},[Date:“Wed, 14 Aug 2024 02:47:56 GMT”, Content-Type:“application/json; charset=utf-8”, Connection:“keep-alive”, X-Request-Id:“f0518806b8b60b5319060b333a240d83”, X-Call-Info:“1120277|1695|122”, Access-Control-Allow-Origin:“*”, Access-Control-Allow-Methods:“GET, OPTIONS”, Access-Control-Allow-Headers:“Authorization, KA, Origin, X-Requested-With, Content-Type, Accept”, content-length:“152”]>
이런형식으로 나옵니다.