Ok it is so close....
public static void printGroupQueryResults(
ContactsService myService) throws ServiceException,
IOException {
// Create query and submit a request
URL feedUrl = new URL("http://www.google.com/m8/feeds/contacts/xxx
%40gmail.com/full");
Query myQuery = new Query(feedUrl);
myQuery.setStringCustomParameter("group", "http://www.google.com/m8/
feeds/groups/xxx%40gmail.com/base/715921bd0c8564cc") ;
ContactFeed resultFeed = myService.query(myQuery,
ContactFeed.class);
// Print the results
System.out.println(resultFeed.getTitle().getPlainText() +
" contacts updated on or after ");
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
ContactEntry entry = resultFeed.getEntries().get(i);
The default is 25 so when I try to get all contacts using ?max-
result=10000 I get this exception thrown:
run:
Exception in thread "main"
com.google.gdata.util.InvalidEntryException: Bad Request
Invalid max-results
at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse
(HttpGDataRequest.java:558)
at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse
(GoogleGDataRequest.java:543)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse
(HttpGDataRequest.java:536)
at com.google.gdata.client.http.HttpGDataRequest.execute
(HttpGDataRequest.java:515)
at com.google.gdata.client.http.GoogleGDataRequest.execute
(GoogleGDataRequest.java:515)
at com.google.gdata.client.Service.getFeed(Service.java:1053)
at com.google.gdata.client.Service.getFeed(Service.java:995)
at com.google.gdata.client.GoogleService.getFeed
(GoogleService.java:662)
at com.google.gdata.client.Service.query(Service.java:1155)
at com.google.gdata.client.Service.query(Service.java:1096)
at contacts.AllContacts.printGroupQueryResults
(AllContacts.java:188)
at contacts.AllContacts.main(AllContacts.java:297)
On Sep 21, 3:55 pm, NMAGOCIO <[email protected]> wrote:
> You need to set a custom parameter with the group ID.
> It will look something like this:
> myQuery.setStringCustomParameter("group", "http://www.google.com/m8/
> feeds/groups/exampleUser%40gmail.com/base/1a3a60420b46e2f7") ;
>
> The rest of the query code is
> here:http://code.google.com/apis/contacts/docs/3.0/developers_guide_java.h...
>
> You will need to list the groups first to get the IDs
> Ran out of time looking into how to get the actual group name. Will
> check back later.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---