Up until now, we used the Google Plus API to get a user\'s public photo. All we needed was the user id to get the photo (as described here).
Now that this and the P
You can use the people.get method of the Google People API to get the information you need with just the user ID. While you can get public information without the user's token, you will need an API key. You also won't be able to get the information if it isn't public.
You need to request exactly which fields you want. The "names" and "photos" fields will probably be the ones most important to you, but there are others available. You'll get an array of possible values, each indicating their source. You will probably want the source type of "PROFILE", but you can certainly evaluate others.
So if you issued a request with
GET https://people.googleapis.com/v1/people/101852559274654726533?personFields=names%2Cphotos&key={YOUR_API_KEY}
You'll be asking for my public profile. You'll get back a response something like
{
"resourceName": "people/101852559274654726533",
"etag": "%EgYBAj0DNy4aDAECAwQFBgcICQoLDA==",
"names": [
{
"metadata": {
"primary": true,
"verified": true,
"source": {
"type": "PROFILE",
"id": "101852559274654726533"
}
},
"displayName": "Allen “Prisoner” Firstenberg",
"familyName": "Firstenberg",
"givenName": "Allen",
"displayNameLastFirst": "Firstenberg, Allen"
}
],
"photos": [
{
"metadata": {
"primary": true,
"source": {
"type": "PROFILE",
"id": "101852559274654726533"
}
},
"url": "https://lh5.googleusercontent.com/-RDndFau_En4/AAAAAAAAAAI/AAAAAAAB8CY/sTL9kJMmIgk/s100/photo.jpg"
}
]
}