I\'m trying to test out the Google Contacts API with JavaScript. I know that V1 had support for JavaScript but V2 and V3 don\'t list it. However, I have been able to find
You need to switch to version 3 of Google Contacts API.
v1 and v2 don't have support for the "search term" (q) parameter, so you're limited to query parameters like "last updated" and "order by" and such.
So. First off they hint that all of your headers need the "GData-Version: 3.0" parameter. https://developers.google.com/google-apps/contacts/v3/#specifying_a_version
If you're using jQuery, that's fairly straightforward. Here's an example: Set Request Header jQuery Ajax
But in the code you've got already, you can just add it to the URL for all requests.
url += "https://www.google.com/m8/feeds/contacts/default/full/?v=3";
(again in jQuery, it's easy to add it as a param too if modifying the header is scary)
The kicker, and it took me weeks to figure this out, is that the "scope" itself is wrong.
In your HTML code I'm sure you've authorized your app using...
scope="https://www.google.com/m8/feeds"
... as it says to do in the documentation. But when they say "all requests need the header" they really mean ALL requests. And if you're using Google's pre-canned HTML examples to authorize your application, then you simply don't have access to the code which would let you modify the headers. So instead you need to use...
scope="https://www.google.com/m8/feeds?v=3"
This is because the v2 API and v3 API share a scope URL, which you really only notice if you're reading the v2.0 and the v3.0 documentation side by side.
Anyway, I hope that helps.
Kieron