Get Google+ ID from Google Contacts

2019-03-02 11:43发布

问题:

I'm pulling a user's contacts email addresses and names using the Google Contacts API. Is there a way to get those people's Google+ IDs as well?

回答1:

The contacts API will return a profile link if a G+ profile is linked with the contact entry.

Here's an example:

<gContact:website href='http://www.google.com/profiles/1234567890' rel='profile'/>

In that element's href attribute, 1234567890 is the person identifier that would match the id field of the relevant person resource from people.list of the Google+ People API.

Note that the profile link is not guaranteed to come back for a contact entry. This occurs when the contact has not been linked to a Google+ profile.