【问题标题】:Is there any way to fetch userid from username in google+ using googleapi?有没有办法使用google api从google+中的用户名中获取用户ID?
【发布时间】:2015-07-31 10:53:02
【问题描述】:

有没有可能从 google plus 中的用户名中找到用户 ID。? 我想通过用户名获取用户的活动。

即用户名是“+LarryPage”然后我需要它的用户 ID 来获取它的活动。但是没有办法通过用户名来识别用户ID。用户名的活动。 只有当我们知道用户 ID 时,活动才可用。

如果不可用,则GooglePlus 团队需要添加此功能以从用户名中找出至少一个用户 ID。

有一个API可以搜索人。但这是不可行的。因为它只检查displayName,这对于太多人来说可能是相同的。

我已附上在 googleplus api 中查找 LarryPage 的响应。但无法确定谁是正确的。

"items": [
  {
   "kind": "plus#person",
   "etag": "\"xoxof0VSFbg0RVYwDJMmg4Jxcp4/PNuMC_dEeZTZ-kScKTd8paGuyXg\"",
   "objectType": "person",
   "id": "106189723444098348646",
   "displayName": "Larry Page",
   "url": "https://plus.google.com/+LarryPage",
   "image": {
    "url": "https://lh3.googleusercontent.com/-Y86IN-vEObo/AAAAAAAAAAI/AAAAAAADO1I/QzjOGHq5kNQ/photo.jpg?sz=50"
   }
  },
  {
   "kind": "plus#person",
   "etag": "\"xoxof0VSFbg0RVYwDJMmg4Jxcp4/zMTOKX19L3IKS43Bv3m6xV0dLNM\"",
   "objectType": "person",
   "id": "111176035772651881663",
   "displayName": "Larry Page",
   "url": "https://plus.google.com/111176035772651881663",
   "image": {
    "url": "https://lh4.googleusercontent.com/-AFDqJCHiTuA/AAAAAAAAAAI/AAAAAAAAAEE/oMOpCoPpfy0/photo.jpg?sz=50"
   }
  },
  {
   "kind": "plus#person",
   "etag": "\"xoxof0VSFbg0RVYwDJMmg4Jxcp4/soC0nCQRAJ8gFoxvRJnf4iwMSB0\"",
   "objectType": "person",
   "id": "101600523208878203536",
   "displayName": "Larry Page",
   "url": "https://plus.google.com/101600523208878203536",
   "image": {
    "url": "https://lh4.googleusercontent.com/-UHYp8q4snW0/AAAAAAAAAAI/AAAAAAAACWs/BRe354a0WfU/photo.jpg?sz=50"
   }
  }
]

【问题讨论】:

    标签: android ios google-api google-plus google-apis-explorer


    【解决方案1】:

    您通常可以交替使用userId 和它们的+username。例如,People.get 记录为:

    GET https://www.googleapis.com/plus/v1/people/userId
    

    或使用真实的userId

    GET https://www.googleapis.com/plus/v1/people/106189723444098348646
    

    但是切换到用户名就可以了:

    GET https://www.googleapis.com/plus/v1/people/+LarryPage
    

    它与Activities.list 的工作方式相同:

    GET https://www.googleapis.com/plus/v1/people/+LarryPage/activities/public
    

    【讨论】:

    • 谢谢。 @arbaham 你的回答对我很有帮助。再次感谢。
    猜你喜欢
    • 2020-10-19
    • 2016-02-19
    • 2022-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    相关资源
    最近更新 更多