Editing contact + changing the photo

55 views
Skip to first unread message

dflorey

unread,
Oct 8, 2009, 3:56:54 AM10/8/09
to Google Contacts API
Hi,
I need some info about what really happens behind the scenes when
uploading a new photo to a contact.
When uploading a photo, it seems that the update timestamp gets
updated.

I want to update a contact and the photo at the same time. So what
steps do I have to take?
From time to time I get mismatching eTag errors when simply updating
the contact and the photo without reloading the contact inbetween.

Can someone provide some more infos?
Thanks a lot in advance,
Daniel

dflorey

unread,
Oct 8, 2009, 4:25:59 AM10/8/09
to Google Contacts API
Some more info from my side:
When
- retrieving a contact
- updating the contact
- reloading the contact (to get the new eTag)
- updating the photo
the new contact info is lost. The new photo is attached, but the
changes on the contact itself are gone

When
- retrieving the contact
- updating the photo
- reloading the contact
- updating the contact
the photo is gone.

So my guess is that is takes some time on the server side to update
the info and that depending on race conditions it sometimes works,
sometimes not.
Is there a reliable way to update both photo and contact info at the
same time?

dflorey

unread,
Oct 8, 2009, 4:54:26 AM10/8/09
to Google Contacts API
Some more info:
My next try was this:
- retrieving the contact
- updating the photo
- reloading the contact UNTIL it gets a new eTag assigned (can take up
to 20 reloads, so my guess that asynchronous photo update causes this
seems to be right)
- updating the contact

Unfortunately, even after retrieving a new contact with updated eTag I
still get:
Failed to update contact 'XXX XXXXX' with url=http://www.google.com/m8/
feeds/contacts/daniel.floreysoft%40googlemail.com/full/
114f9fc98f4acbb6'
com.google.gdata.util.PreconditionFailedException: OK
Mismatch: etags = ["R3c7fjVSLyt7ImA9WxNXGUQLRA0."], version
= [1254991136967000]

I am using the fresh entry with the new etag to do the update so this
looks like a bug to me.

Julian (Google)

unread,
Oct 9, 2009, 8:18:28 AM10/9/09
to Google Contacts API
Hi Daniel,

You can only update the contact and its photo separately, what you
describe certainly looks like a bug, we will try to reproduce it in
our end. If possible, please also share a sample of your code.

Cheers,
Julian

dflorey

unread,
Oct 9, 2009, 12:34:58 PM10/9/09
to Google Contacts API
It seems like timing issues. I get back the updated entry, BUT it is
still not updated when uploading a photo and vice versa.
I guess Google is distributing the changes to several servers or is
somehow returning the new entry before it is assured that when
retrieving the contact by api to really get the latest data.
And what is even more strange: Sometimes I managed to somehow get the
contact info from 3 updates ago...this is really unpredictable.
I can of course provide some code samples but it is not much different
from the docs from the examples.
Just try to update a contact and a photo directly after each other and
you'll see.
I'm running my code on App Engine, but it is in the same thread so
this should no be an issue.

Julian (Google)

unread,
Oct 18, 2009, 3:02:17 PM10/18/09
to Google Contacts API
Hi Daniel,

It is not possible to update the contact and the photo at the same
time, because updating a contact's photo causes a contact timestamp
change. In the other hand, there is a replication process behind the
scenes, this causes a delay after the update and because of this you
may need to wait a bit longer to be able to perform the second update.

Regards,
Julian

On Oct 9, 5:34 pm, dflorey <daniel.flo...@gmail.com> wrote:
> It seems like timing issues. I get back the updated entry, BUT it is
> still not updated when uploading a photo and vice versa.
> I guess Google is distributing the changes to several servers or is
> somehow returning the new entry before it is assured that when
> retrieving thecontactby api to really get the latest data.
> And what is even more strange: Sometimes I managed to somehow get thecontactinfo from 3 updates ago...this is really unpredictable.
> I can of course provide some code samples but it is not much different
> from the docs from the examples.
> Just try to update acontactand a photo directly after each other and
> you'll see.
> I'm running my code on App Engine, but it is in the same thread so
> this should no be an issue.
>
> On 9 Okt., 14:18, "Julian (Google)" <j...@google.com> wrote:
>
> > Hi Daniel,
>
> > You can only update thecontactand its photo separately, what you
> > describe certainly looks like a bug, we will try to reproduce it in
> > our end. If possible, please also share a sample of your code.
>
> > Cheers,
> > Julian
>
> > On Oct 8, 9:54 am, dflorey <daniel.flo...@gmail.com> wrote:
>
> > > Some more info:
> > > My next try was this:
> > > - retrieving thecontact
> > > - updating the photo
> > > - reloading thecontactUNTIL it gets a new eTag assigned (can take up
> > > to 20 reloads, so my guess that asynchronous photo update causes this
> > > seems to be right)
> > > - updating thecontact
>
> > > Unfortunately, even after retrieving a newcontactwith updated eTag I
> > > still get:
> > > Failed to updatecontact'XXX XXXXX' with url=http://www.google.com/m8/
> > > feeds/contacts/daniel.floreysoft%40googlemail.com/full/
> > > 114f9fc98f4acbb6'
> > > com.google.gdata.util.PreconditionFailedException: OK
> > > Mismatch: etags = [&quot;R3c7fjVSLyt7ImA9WxNXGUQLRA0.&quot;], version
> > > = [1254991136967000]
>
> > > I am using the fresh entry with the new etag to do the update so this
> > > looks like a bug to me.
>
> > > On 8 Okt., 10:25, dflorey <daniel.flo...@gmail.com> wrote:
>
> > > > Some more info from my side:
> > > > When
> > > > - retrieving acontact
> > > > - updating thecontact
> > > > - reloading thecontact(to get the new eTag)
> > > > - updating the photo
> > > > the newcontactinfo is lost. The new photo is attached, but the
> > > > changes on thecontactitself are gone
>
> > > > When
> > > > - retrieving thecontact
> > > > - updating the photo
> > > > - reloading thecontact
> > > > - updating thecontact
> > > > the photo is gone.
>
> > > > So my guess is that is takes some time on the server side to update
> > > > the info and that depending on race conditions it sometimes works,
> > > > sometimes not.
> > > > Is there a reliable way to update both photo andcontactinfo at the
> > > > same time?
>
> > > > On 8 Okt., 09:56, dflorey <daniel.flo...@gmail.com> wrote:
>
> > > > > Hi,
> > > > > I need some info about what really happens behind the scenes when
> > > > > uploading a new photo to acontact.
> > > > > When uploading a photo, it seems that the update timestamp gets
> > > > > updated.
>
> > > > > I want to update acontactand the photo at the same time. So what

Zindus Development

unread,
Oct 19, 2009, 8:14:34 AM10/19/09
to google-co...@googlegroups.com
Julian (Google) wrote:
> It is not possible to update the contact and the photo at the same
> time, because updating a contact's photo causes a contact timestamp
> change. In the other hand, there is a replication process behind the
> scenes, this causes a delay after the update and because of this you
> may need to wait a bit longer to be able to perform the second update.

By "wait a bit longer", can you suggest a reasonable threshold? 1s? 2s?
10s?

Leni

dflorey

unread,
Oct 21, 2009, 5:02:42 AM10/21/09
to Google Contacts API
Hi Julian,
more info would be highly appreciated. Can you give us a hint how to
implement changing contact+photo in a reliable way?
My customers suffer from very strange side effects when enabling photo
sharing.

Thanks,
Daniel

Julian (Google)

unread,
Oct 22, 2009, 9:52:26 AM10/22/09
to Google Contacts API
Hi,

We have received reports of extreme cases where a developer needs to
wait up to 1 minute for an update. We know this is not ideal and until
we make this more reliable, a solution is to retrieve the contact
again and compare its ETag and/or updated time with the results of the
update.

Cheers,
Julian

dflorey

unread,
Oct 24, 2009, 8:48:18 AM10/24/09
to Google Contacts API
Unfortunately even when checking the ETag you may get

ailed to update contact 'XXX XXXXX' with url=http://www.google.com/
m8/
feeds/contacts/daniel.floreysoft%40googlemail.com/full/
114f9fc98f4acbb6'
com.google.gdata.util.PreconditionFailedException: OK
Mismatch: etags = [&quot;R3c7fjVSLyt7ImA9WxNXGUQLRA0.&quot;], version
= [1254991136967000]

So my plan is to check for a new etag and wait for another minute once
the etag changed. It that a safe approach?

Julian (Google)

unread,
Oct 28, 2009, 4:33:20 AM10/28/09
to Google Contacts API
That is a good plan, check the new ETag, wait around 1 minute, and
retry few times if it fails.

Cheers,
--Julian

On Oct 24, 5:48 pm, dflorey <daniel.flo...@gmail.com> wrote:
> Unfortunately even when checking the ETag you may get
>
> ailed to updatecontact'XXX XXXXX' with url=http://www.google.com/
> m8/
> feeds/contacts/daniel.floreysoft%40googlemail.com/full/
> 114f9fc98f4acbb6'
> com.google.gdata.util.PreconditionFailedException: OK
> Mismatch: etags = [&quot;R3c7fjVSLyt7ImA9WxNXGUQLRA0.&quot;], version
> = [1254991136967000]
>
> So my plan is to check for a new etag and wait for another minute once
> the etag changed. It that a safe approach?
>
> On 22 Okt., 15:52, "Julian (Google)" <j...@google.com> wrote:
>
>
>
> > Hi,
>
> > We have received reports of extreme cases where a developer needs to
> > wait up to 1 minute for an update. We know this is not ideal and until
> > we make this more reliable, a solution is to retrieve thecontact
> > again and compare its ETag and/or updated time with the results of the
> > update.
>
> > Cheers,
> > Julian
>
> > On Oct 21, 10:02 am, dflorey <daniel.flo...@gmail.com> wrote:
>
> > > Hi Julian,
> > > more info would be highly appreciated. Can you give us a hint how to
> > > implement changingcontact+photo in a reliable way?
> > > My customers suffer from very strange side effects when enabling photo
> > > sharing.
>
> > > Thanks,
> > > Daniel
>
> > > On Oct 19, 2:14 pm, Zindus Development <google....@zindus.com> wrote:
>
> > > > Julian (Google) wrote:
> > > > > It is not possible to update thecontactand the photo at the same

lcf

unread,
Nov 18, 2009, 7:52:13 PM11/18/09
to Google Contacts API
Which option was chosen for zindus at last?
Reply all
Reply to author
Forward
0 new messages