【发布时间】:2017-09-23 09:05:54
【问题描述】:
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。请求后我收到以下错误:
"{ “错误”: { “代码”:400, "message": "无效的 personFields 掩码路径:\"\"names\"。有效路径记录在 https://developers.google.com/people/api/rest/v1/people/get.", “状态”:“INVALID_ARGUMENT” } } "
有人可以建议我一条有效的路径吗?我在文档中没有找到。
【问题讨论】: