I've managed to get OAuth working to access Google Contacts from GAE. I'm 
using the Python client libraries and I can - as a test - list all the 
contacts from a suitably authorized 
*gdata.contacts.client.ContactsClient*object. However it fails when I try to 
add a new contact using the 
ContactsClient object. I create the new 'random' entry using code similar to 
that in one of the getting started docs:

*r = str(datetime.now().strftime(**'%s'**))*

*new_contact = gdata.contacts.ContactEntry(title=atom.Title(text=**
'Adrian.XXXX.'**+r))*

*new_contact.content = atom.Content(text=**'This is a test contact generated 
at time '**+r)*

*new_contact.email.append(gdata.contacts.Email(address=**'adrian.xxxx.'**+r+
**'**@gmail.com**'**, primary=**'true'**, rel=gdata.contacts.REL_WORK))*


but the call to actually add the contact 


*contact_entry = client.add_contact(new_contact)*


fails with "*Server responded with: 400, Entry does not have any fields set.
*" However, if I log new_contact then I get pretty much the XML I would 
expect it.

*<?xml version='1.0' encoding='UTF-8'?>**<ns0:entry 
xmlns:ns0="http://www.w3.org/2005/Atom";>*

***<ns0:content>This is a test contact generated at time 
1298323404</ns0:content>*

*<ns0:title>Adrian.XXXX.1298323404</ns0:title>*

*<ns1:email address="[email protected]" primary="true" 
rel="http://schemas.google.com/g/2005#work"; 
xmlns:ns1="http://schemas.google.com/g/2005"; />*

*</ns0:entry>*

Does anybody have any idea what might be going wrong. I saw some posts about a 
similar problem from 2008 but I think they were generating the XML by hand and 
there was a problem with missing namespaces. I don't see how that can be the 
problem here. 

As always, any help would be greatly appreciated,

Adrian


-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to