I have the oauth authorization with google working correctly and am getting data from the contacts api. Now, I want to programmatically get a gmail user's first name, last name and picture. Which google api can i use to get this data?
|
I found the answer while looking around in the contacts API forum. When you get the result-feed, just do the following in Java- String Name = resultFeed.getAuthors().get(0).getName(); String emailId = resultFeed.getId(); Im still looking for a way to get the picture. |
|||||||
|
The contacts API perhaps works, but you have to request permission from the user to access all contacts. If I were a user, that would make me wary of granting the permission (because this essentially gives you permission to spam all my contacts...) I found the response here to be useful, and only asks for "basic profile information": I have successfully used this approach, and can confirm it returns the following Json object:
|
|||
|
For the picture, you can use the Google contacts Data API too: see http://code.google.com/intl/fr/apis/contacts/docs/3.0/developers_guide_protocol.html#retrieving_photo |
|||||||||||
|
The simplest way to get this information would be from the Google + API. Specifically the https://developers.google.com/+/api/latest/people/get When using the api use the following HTTP GET:
This will return all of the above information requested from the user. |
||||
|