As an admin can I modify a user's contacts, (aka My Contacts) via API?

73 views
Skip to first unread message

NMAGOCIO

unread,
Oct 22, 2009, 2:22:55 PM10/22/09
to Google Contacts API
I tried the 2 - legged OAuth method we use for Documents but it does
not work in Contacts. This would be similar to what is done in
Profiles.

Julian (Google)

unread,
Oct 29, 2009, 2:15:15 AM10/29/09
to Google Contacts API
Hi,

It is possible to use 2-legged OAuth to get users contacts within a
Apps Domain:
http://code.google.com/apis/accounts/docs/OAuth.html#GoogleAppsOAuth

Small sample in Java:
ContactsService service = new ContactsService("app-name");

// Oauth
OAuthSigner signer = new OAuthHmacSha1Signer();
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey("domain.com");
oauthParameters.setOAuthConsumerSecret("XXXX....");
oauthParameters.setScope("http://www.google.com/m8/feeds/");

// Create ContactService and authenticate using oauth credentials
service.setOAuthCredentials(oauthParameters, signer);
GoogleOAuthHelper oauthHelper = new GoogleOAuthHelper(signer);

URL feedUrl = new URL("http://www.google.com/m8/feeds/contacts/
us...@domain.com/full?
xoauth_requestor_id=us...@domain.com&groupid=http://www.google.com/m8/
feeds/groups/us...@domain.com/base/6");
ContactFeed resultFeed = contactsService.getFeed(feedUrl,
ContactFeed.class);
System.out.println(resultFeed.getEntries().size());
...

Cheers,
Julian
Reply all
Reply to author
Forward
0 new messages