【问题标题】:How can i set 'personFields' query parameter in Google People API get request?如何在 Google People API 获取请求中设置“personFields”查询参数?
【发布时间】: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” } } "

有人可以建议我一条有效的路径吗?我在文档中没有找到。

【问题讨论】:

    标签: google-people-api


    【解决方案1】:

    personFields='names,photos,coverPhotos' 更改为personFields=names,photos,coverPhotos,不带'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多