안녕하세요. 다중 경로 길찾기 rest api를 ajax로 호출하는데 400오류(-2)가 리턴되서 질문드립니다.
코드는 다음과 같습니다.(restapi key 제외하고 코드 전체 첨부합니다.)
데이터가 뭐가 잘못된건지 가르침이 필요합니다.
감사합니다.
$.ajax({
//경유지 길찾기
type : "POST",
url : "https://apis-navi.kakaomobility.com/v1/waypoints/directions",
data : {
"origin": {
"x": "127.11024293202674",
"y": "37.394348634049784"
},
"destination": {
"x": "127.10860518470294",
"y": "37.401999820065534"
},
"waypoints": [
{
"name": "name0",
"x": "127.11341936045922",
"y": "37.39639094915999"
}
],
"priority": "RECOMMEND",
"car_fuel": "GASOLINE",
"car_hipass": false,
"alternatives": false,
"road_details": false
},
headers : { 'Authorization' : 'KakaoAK {restAPI key}'},
dataType: 'json',
contentType : 'application/json',
success : function(res){
console.log('통신 성공')
console.log(res);
},
error : function(XMLHttpRequest, textStatus, errorThrown){
console.log('통신 실패')
console.log(XMLHttpRequest);
}
});