Google Contacts API with Google JavaScript Client Lib

einsA picture einsA · Dec 31, 2012 · Viewed 11.9k times · Source

I am trying to work with the Google Contacts API v3.

Because of the OAuth2 authentication and authorization I'm started with the Google APIs Client Library for JavaScript. I have no problems with that part of the API access.

But after doing the auth part I don't know what to do next. Can I use the google-api-javascript-client for the Google Contacts API v3? In the list of the supported Google APIs by the javascript-client the contacts API does not appear. But I have full access with the OAuth 2.0 Playground tool.

I am really confused which client is working best with the latest Google Contacts API. What is about the gdata-javascript-client?

Answer

ganoro picture ganoro · Aug 29, 2013

To use the v3 contacts api with the authentication token provided by gapi (Google JS client lib) this one is helpful, using alt=&json

$.getJSON('https://www.google.com/m8/feeds/contacts/default/full/?access_token=' + 
             authResult.access_token + "&alt=json&callback=?", function(result){
      console.log(JSON.stringify(result));
});