Retrieving a user's public google/gmail picture

shaish picture shaish · Sep 1, 2014 · Viewed 49.7k times · Source

I'm writing an email-based application using the gmail-api, and i need to retrieve user public images for email address originating from google. I've seen other applications do that, but i can't seem a way to reliably get this data.

some more information:

  • i'm using oauth2 to sign the user in - and i have no problem requesting any type of permissions there.
  • i've tried retrieving the image using the google+ api - but it requires a userID for that - and i don't know how to get the userId for the email address (gmail-api doesn't give it, afaik).
  • i've tried using the contacts API - but it only gives images for the user's contacts, while the email clients can display images from other users as well.

Thanks!

Edit:

I know i can receive the required images from google plus, if i have the other user's userid. however, i can't find a way to get the userid based on an email address.

Answer

jose920405 picture jose920405 · Nov 25, 2015

Is very easy

http://picasaweb.google.com/data/entry/api/user/<hereYourUserIdOrYourEmail>?alt=json

just has a little problem.

You only can get the picture of your Google+ profile, not directly from your gmail.

UPDATE:

This API is being deprecated and will be turned down in January 2019. Migrate to Google Photos Library API as soon as possible to avoid disruptions to your application.

More Info Here