2017-09-23 3 views
0
var xhttp = new XMLHttpRequest(); 
    var theUrl = "https://people.googleapis.com/v1/people/c3591871730916654475?personFields='names,photos,coverPhotos'"; 
    xhttp.open("GET", theUrl, true); 
    xhttp.setRequestHeader('Authorization', 'Bearer ' + currentSessionAccessToken) 
    xhttp.onload = function(){ 
    if(xhttp.status == 200){ 
     var profileJson = JSON.parse(xhttp.response); 
     resolve(profileJson);  
    } 
    else{ 
     if(xhttp.status == 404){ 
      resolve('No_RESULT_FOUND'); 
     } 
     else{ 
     reject(xhttp.statusText); 
     } 
    } 
    }; 
    xhttp.onerror = function(){ 
    reject(xhttp.statusText); 
    }; 
    xhttp.send(); 

위의 내용은 제 XMLHttpRequest입니다. 요청 후 나는 아래의 오류 :Google Person API에서 'personFields'검색어 매개 변수를 설정하려면 어떻게해야합니까?

"{ "오류 ": { "코드 ": 400, "메시지 ":"잘못된 personFields 경로 마스크 :. \ "\"이름 \ "유효한 경로가 있습니다 https://developers.google.com/people/api/rest/v1/people/get에서 문서화 " "상태입니다. ":"? INVALID_ARGUMENT " } 가} 는"

어떤 사람이 나에게 올바른 경로를 제안 할 수 나는 문서에서 찾을 수 없습니다

답변

1

personFields=names,photos,coverPhotos로 변경 personFields='names,photos,coverPhotos'없이. '.

+0

효과가 있습니다. 감사. –