1
votes

I ran into an interesting case where it seems to indicate that the documentation for Google Contacts API is incorrect.

What I'm trying to do is getting the contact information of authenticated user who has already given permission to the app using this URL:

https://www.google.com/m8/feeds/contacts/default/full/contactId

The result of the call is always status 404. However, when I'm trying to get full address book, it seems to be working fine.

https://www.google.com/m8/feeds/contacts/default/full

Is it documented incorrect or I'm doing something wrong? It makes no sense that I can get the whole address book without being able to get contact information of the authenticated user.

The scope I'm using is:

https://www.google.com/m8/feeds

Thanks, Jack


Additional information. The API documentation shows the following:

public static ContactEntry retrieveContact(ContactsService myService) {
  ContactEntry contact =
      myService.getEntry(new URL("https://www.google.com/m8/feeds/contacts/default/full/contactId"),
          ContactEntry.class);
  // Do something with the contact.
  return contact;
}

This seems to mean that "contactId" keyword should used as part of URL. It just doesn't work for me.


To clarify this question. The goal is to get information on current authenticated user without having to go through workaround of fetching data multiple times. Even with the workaround of fetching all contact first, I didn't see any contactId of authenticated user coming back with it.

1

1 Answers

1
votes

It depends on what you are trying to get. If you call https://www.google.com/m8/feeds/contacts/default/full, then you are looking for all the contacts. Now, when you get back the contacts, you can request the data for a single contact by using https://www.google.com/m8/feeds/contacts/default/full/{contactID} where {contactID} is the last part of the field from the full contact list. It will look like http://www.google.com/m8/feeds/contacts/{user email}/base/{contact id}.

So, if you get back the full contact list, a single contact will have an ID field that looks like: http://www.google.com/m8/feeds/contacts/{user email}/base/{contact id}. If you take that last {contact ID} and append it to the end of the call (https://www.google.com/m8/feeds/contacts/default/full/{contactID} ), you will get back the contact information for just that contact.