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。请求后,我收到以下错误:
"{ "error": { "code": 400, "message": "Invalid personFields mask path: \"\"names\"。有效路径记录在https://developers.google.com/people/api/ rest/v1/people/get .", "status": "INVALID_ARGUMENT" } } "
有人可以建议我一条有效的路径吗?我在文档中没有找到。