Hello,
I'm trying to add contacts inside a group using OAuth. The group and
contacts creation works fine. When I try to add the
GroupMembershipInfo object it throws an
com.google.gdata.util.InvalidEntryException: Bad Request Group
membership information not supported. Here is the code...
//two-legged oauth initialization
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters
();
oauthParameters.setOAuthConsumerKey(domain);
oauthParameters.setOAuthConsumerSecret(secret);
OAuthSigner signer = new OAuthHmacSha1Signer();
GoogleOAuthHelper oauthHelper = new GoogleOAuthHelper(signer);
oauthParameters.setScope(scope);
ContactsService contactsService = new ContactsService(appTitle);
contactsService.setOAuthCredentials(oauthParameters, signer);
// Create group the entry to insert
ContactGroupEntry group = new ContactGroupEntry();
group.setTitle(new PlainTextConstruct(groupName));
// Create the contact object
ContactEntry contact = new ContactEntry();
contact.setTitle(new PlainTextConstruct(name));
// Ask the service to insert the new group entry
String feedGroupUrlInsert = feedGroupUrlString;
feedGroupUrlInsert += "?xoauth_requestor_id=" + currentUser + "@"
+ domain;
URL postGroupUrl = new URL(feedGroupUrlInsert);
group = contactsService.insert(postGroupUrl, group);
//Create a group membership info object
GroupMembershipInfo groupInfo = new GroupMembershipInfo();
groupInfo.setDeleted(false);
groupInfo.setHref(group.getId());
contact.addGroupMembershipInfo(groupInfo);
//Add the contact
String feedUrlInsert = feedContactUrlString;
feedUrlInsert += "?xoauth_requestor_id=" + currentUser + "@" +
domain;
URL postContactUrl = new URL(feedUrlInsert);
contact = contactsService.insert(postContactUrl, contact);
Thanks for any help,
David Cifuentes
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" 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://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---