Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Contacts API v3: how to use full text query?

I cannot seem to get a search of Google Contacts using a query parameter to work.

I can successfully authenticate the user, get a list of Contacts Groups, and get a list of contacts within a group, but cannot get a search to work.

From the documentation, I'd assume that my URI would have to look something like this to do a search for "tracy" in the default user's contacts (assuming I've already been authenticated via OAuth2):

https://www.google.com/m8/feeds/default/full?q=tracy

However, I get a "Bad Request" response (_rc = 400)

I suppose that I could download all the contacts and then do the search myself, but I can't imagine there's no way for GOOGLE(!) to do this search on the server.

Any help greatly appreciated! Thanks!

like image 453
threecee Avatar asked Jul 17 '14 19:07

threecee


1 Answers

I ran into a similar problem with the q parameter being ignored. I had to add version parameter, v=3.0, for the q to be recognized as illustrated by this post.

Your full URL should be:

https://www.google.com/m8/feeds/contacts/default/full?q=tracy&v=3.0

Note the corrected URL as mentioned by Blake O.

For my use, I also added the access_token parameter that I get after gapi.auth.authorize from the Google API Client JS library

like image 185
Foo L Avatar answered Oct 16 '22 04:10

Foo L