Updating a photo for a shared contact is slightly different than updating a shared contact's information. For information about working with a shared contact's information, see Update or delete a shared contact. When using photo links, you must specify the authorization token in the HTTP header. For more information, see Learn about authentication and authorization.
Update a photo for a shared contact
Every shared contact has a photo link element. The photo link element appears
whether the contact has an associated photo or not. If the contact does have a
photo, then the element contains a gd:etag
attribute that specifies an ETag
HTTP header for the photo. An ETag
lets you refer to a specific version of a
particular entry. In this case, it lets you refer to a specific verion of a
photo. If the contact has no photo, then there's no gd:etag
attribute, and
the href
attribute provides the URL to use to add a
photo to the contact.
To add or update a photo, send a new photo:
PUT https://www.google.com/m8/feeds/photos/media/liz%40DOMAIN/PHOTO_LINK
Replace the following:
DOMAIN
: The URL for your domain—for example, example.com.PHOTO_LINK
: A unique numerical value that represents the photo link for the shared contact—for example, c9012de.
The following is an example of a photo link element:
<link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*" href="https://www.google.com/m8/feeds/photos/media/liz%40example.com/c9012de">
Delete a photo for a shared contact
To delete a photo, you must use the HTTP DELETE
method.
When updating or deleting a photo, send the photo's ETag
in the If-Match
header of the HTTP request. If you don't have the latest version of the photo
use If-Match: *
to override the versioning system and delete the photo.
For more information about ETags
, see the
Google Data APIs protocol reference.