0

I used to be able to use the Google+ API for this, but that API is being shutdown.

I'm wondering if there exists a way to both

  1. Get the URL for a user's profile image
  2. Know whether or not the image is Google's default image, or an image set by the user

I've found other Google APIs that provide an image URL, such as oauth2.userinfo.get, but I have been unable to find an API provides something like Google+'s isDefault field.

nipucel
  • 1
  • 1

1 Answers1

0

You can try using the People API. The API has a people.get method which returns an instance of Person:

{
  "resourceName": string,
  "etag": string,
  "metadata": {
    object(PersonMetadata)
  },
  ...
  "photos": [
    {
      object(Photo)
    }
  ],
  ...
}

The photos field returns the person's read-only photos.

JSON representation:

{
  "metadata": {
    object(FieldMetadata)
  },
  "url": string,
  "default": boolean
}

where,

  • metadata - object(FieldMetadata)
    • Metadata about the photo.
  • url - string
    • The URL of the photo. You can change the desired size by appending a query parameter sz=size at the end of the url. Example: https://lh3.googleusercontent.com/-T_wVWLlmg7w/AAAAAAAAAAI/AAAAAAAABa8/00gzXvDBYqw/s100/photo.jpg?sz=50
  • default - boolean
    • True if the photo is a default photo; false if the photo is a user-provided photo.
Jacque
  • 757
  • 4
  • 9