I've been able to retrieve everything but the contacts photo by following the API.
I can get the img url as well as the gd:etag from the xml returned. Below is the Google API example, and it is the same thing I get, with the value of the attributes being different of course for my contacts.
<link rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/*'
href='https://www.google.com/m8/feeds/photos/media/liz%40gmail.com/c9012de'
gd:etag='"KTlcZWs1bCp7ImBBPV43VUV4LXEZCXERZAc."'>
The problem is I don't know how to get it to display. When I try it, I just get the last part of the url (ie: "/32432eewqdweq") and no image.
I'm using rails, and this is my second week of doing web development, sorry if I seem noobish aha.
Any help would be appreciated!
Thanks,
Goran
Open the contact. Under the contact name, scroll down for Google Profile. If you right click on the photo, you have the option to save or download the image.
Using the Google Photos Library API your app can read, write, and share photos and videos in Google Photos. The Library API is a RESTful API with JSON payload. The structure of the API is based on the product concepts of Google Photos: Library: media stored in the user's Google Photos account.
To access personal contacts: https://www.googleapis.com/auth/contacts. To access directory information: https://www.googleapis.com/auth/directory.readonly. Note: The Domain Shared Contacts API is not affected by these changes.
You would need to make a request to the url, but also include the access_token as a query parameter.
So, using your example, let's say if your access_token is ABCDEF123456ABCDEF, then the GET request you want to make is:
https://www.google.com/m8/feeds/photos/media/liz%40gmail.com/c9012de?access_token=ABCDEF123456ABCDEF
Just a small hint, according to Google's API docs:
Note: If a contact does not have a photo, then the photo link element has no gd:etag attribute.
More info here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With