title: How do you use query parameters to limit retrieved contacts in the Google Contacts API
body: <p>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 a way to retrieve contacts through an AJAX request so getting the contacts isn't really the problem right now.  However, I'd like to be able to specify the search criteria of the contact that I'm looking for so that I don't have to page and search through all of the users contacts.</p>
  
  <p>Right now, my code looks like this:</p>
  
  <pre><code>function getContact(domTarget) {
     // Get permission and a token
     auth(function(token) {
  
        // Create an AJAX request to get the contacts
        var ajaxContactRequest = new XMLHttpRequest(),
                url = "";
  
        // What to do when we get our contacts
        ajaxContactRequest.onreadystatechange = function() {
           if (ajaxContactRequest.readyState === 4 &amp;&amp; ajaxContactRequest.status === 200) {
  
              // Parse our contact data as a JSON object
              var response = JSON.parse(ajaxContactRequest.responseText),
                      contactArray = response.feed.entry, i, contactDiv;
  
              // Print out the contacts
              if (domTarget) {
                 for (i = 0; i &lt; contactArray.length; i++) {
                    if (contactArray[i].title &amp;&amp; contactArray[i].title.$t) {
                       contactDiv = document.createElement("div");
                       domTarget.appendChild(contactDiv);
  
                       // Print out the contact's name
                       contactDiv.innerHTML = contactArray[i].title.$t;
                    }
                 }
              }
           }
        };
  
        // Construct our URL
        url += "https://www.google.com/m8/feeds/contacts/default/full/";
        // Add the access token
        url += "?access_token=" + token.access_token;
        // Get JSON format back
        url += "&amp;alt=json";
        // Limit to 10 results
        url += "&amp;max-results=10";
  
        // Open the request
        ajaxContactRequest.open("GET", url, false);
  
        // Send it away
        ajaxContactRequest.send();
     });
  }
  </code></pre>
  
  <p>I know that there is some sort of support for queries because the listing here: <a href="https://developers.google.com/google-apps/contacts/v3/#retrieving_contacts_using_query_parameters" rel="nofollow">Retrieving Contacts Using Query Parameters</a> mentions that you can use the parameters found here: <a href="https://developers.google.com/google-apps/contacts/v3/reference#Parameters" rel="nofollow">Contacts Query Parameters Reference</a> which lists <code>q=term1 term2 term 3</code> and `q="term1 term2 term3" are the way to do "Fulltext query on contacts data fields".</p>
  
  <p>I have tried several different mixes of parameters such as first and last name as well as dates and emails.  However, none of them have any impact on the results.  Another thing that I am wondering is if this really matters.  I'm limiting my query based on name only to try and reduce the size of the response.  However, if the better practice is to just grab the whole contact set and then glean the bits of info that you need, I guess I can do that instead.</p>
  
  <p>I figure you have to do multiple requests if the number of contacts is larger than the <code>max-results</code> size.</p>