Fulltext query on contacts data fields

205 views
Skip to first unread message

chris4beta

unread,
May 5, 2011, 4:42:38 AM5/5/11
to google-co...@googlegroups.com
I started playing the the contacts API today to maybe use in a new Chrome extension, and I have what may be a simple question.

First, I downloaded the sample extension for using oauth with contacts:

All good - after authenticating, it is accessing my contacts.

In the source is the following code:

oauth.sendSignedRequest(url, onContacts, {
  'parameters' : {
    'alt' : 'json',
    'max-results' : 100
  }
});

Changing max-results to 10 works as it should, so I reason that this is where I can add/edit all query parameters. Looking at the 3.0 reference docs here:
I see that you can set a parameter 'q' that is "Fulltext query on contacts data fields."

Great, so I change the above code to:

oauth.sendSignedRequest(url, onContacts, {
  'parameters' : {
    'q' : 'chris',
    'alt' : 'json',
    'max-results' : 100
  }
});

No change... the same list of contacts is being returned, when it should be searching for the term 'chris' within the contact data. At least that is what the parameter reference documentation says it should do.

As I understand it, v2.0 of the API did not allow fulltext search, but v3.0 does? How would I go about searching by contact name, or any other field like address? Declaring a 'q' parameter seems to do nothing. Am I doing something wrong?

Thanks for any help you can give.

Alain

unread,
May 5, 2011, 11:48:10 AM5/5/11
to google-co...@googlegroups.com
Hello,

You can check what version of the API you are using by using the developer tools in Chrome:

That will let you know what headers is sent to the API. Additionally, you could use the query parameter to specify the requested version of the API:

Best,
Alain

chris4beta

unread,
May 5, 2011, 2:43:21 PM5/5/11
to google-co...@googlegroups.com
Thanks so much, it was using v1.0... switched to 3.0 and searching works great.

-Chris
Reply all
Reply to author
Forward
0 new messages