On Dec 16, 11:37 pm, martinlong1978 <mar...@longhome.co.uk> wrote:
> I'm using the .NET api now, although I've seen exactly the same
> through the Java API, so it would suggest this is a server issue.
>
> When I create a contact there is some kind of race condition, meaning
> that _sometimes_ (about 1 in 3) I cannot upload an image for that
> contact.
>
> To create the contact:
>
> Uri feedUri = new Uri
> (ContactsQuery.CreateContactsUri("default")); // This appears to be
> redundent
> Feed<Contact> feed = cr.GetContacts();
> entry = cr.Insert(feed, entry);
> updatePicture();
>
> To upload the photo:
>
> // I've tried up to a 1 min delay before this.
> entry = cr.Update(entry);
> Console.WriteLine(entry.PhotoUri);
> cr.SetPhoto(entry, photoStream);
>
> I get a GDataRequestException:
>
> {"Execution of request failed:
> http://www.google.com/m8/feeds/photos/media/testu...@longhome.co.uk/20d591310a37df9d"}
>
> {"The remote server returned an error: (404) Not Found."}
>
> However, when I query the feed, it's there, I get:
>
> <entry>
> <id>http://www.google.com/m8/feeds/contacts/testuser%40longhome.co.uk/
> base/20d591310a37df9d</id>
> <updated>2009-12-16T22:28:40.737Z</updated>
> <category scheme='http://schemas.google.com/g/2005#kind'term='http://
> schemas.google.com/contact/2008#contact'/>
> <title type='text'>xxxxxxx</title>
> <content type='text'></content>
> <link rel='http://schemas.google.com/contacts/2008/rel#edit-photo'
> type='image/*' href='http://www.google.com/m8/feeds/photos/media/
> testuser%40longhome.co.uk/20d591310a37df9d/1B2M2Y8AsgTpgAmY7PhCfg'/>
> <link rel='self' type='application/atom+xml' href='http://www.google.com/m8/feeds/contacts/testuser%40longhome.co.uk/full/20d59...>
> <link rel='edit' type='application/atom+xml' href='http://www.google.com/m8/feeds/contacts/testuser%40longhome.co.uk/full/20d59...>
Slightly different circumstances, as my is a new contact, not an
updated one, but it looks like the same underlying issue.
Unfortunately I cannot wait for an ETag change, because the contact is
new - I can't see the ETag updating once the contact is created.
Waiting for 1 minute would mean it could take 2 hours to sync 120
contacts, unless I set up a workerthread to upload the pictures - God
know what race conditions I'll see then.
"Check the new ETag, wait around 1 minute, and retry few times if it
fails" - OUCH! I hope this is fixed soon.
Martin
On Dec 17, 10:00 am, dflorey <daniel.flo...@gmail.com> wrote:
> See:
>
> http://groups.google.com/group/google-contacts-api/browse_thread/thre...
> > <link rel='self' type='application/atom+xml' href='http://www.google.com/m8/feeds/contacts/testuser%40longhome.co.uk/ful......>
> > <link rel='edit' type='application/atom+xml' href='http://www.google.com/m8/feeds/contacts/testuser%40longhome.co.uk/ful......>
A good strategy is to create all the contacts and store the photo URLs
during the creation process, then upload all the photos after all
contacts have been created. Please try that and let us know how it
goes.
Cheers,
Julian
Interestingly last night when I tried the separate thread I was
getting a lot of ' precondition failed' issues. I'll report back when
I get the chance.
Martin
Sent from my iPhone
> --
>
> You received this message because you are subscribed to the Google
> Groups "Google Contacts API" group.
> To post to this group, send email to google-co...@googlegroups.com
> .
> To unsubscribe from this group, send email to google-contacts...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
> .
>
>
It should be possible to update/create a contact with both contact data
+photo.
It's really a mess to schedule the photo upload especially when
running on app engine where you cannot schedule tasks dynamically.