有什么方法可以使用 googleapi 从 google+ 中的用户名获取用户 ID?

Is there any way to fetch userid from username in google+ using googleapi?

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

即用户名是“+LarryPage”然后我需要它的用户 ID 来获取它的活动。但是没有办法通过username来识别userid。按用户名的活动。 仅当我们知道用户 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"
   }
  }
]

您通常可以互换使用 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