Search code examples
google-contacts-api

How to retrieve a single contact with gdata? Getting a 'not supported' error


I'm copying the code here https://developers.google.com/google-apps/contacts/v3/#retrieving_a_single_contact.

And here's my code:

Dim cr = ContactAuthentication()
Dim groups = GetGroups(cr)
Dim entry As Contact
entry = cr.Retrieve(Of Contact)(New Uri("https://www.google.com/m8/feeds/contacts/default/full/38B2D4F80D96B2C2"))

On the last line, it falls with the following error:

Google.GData.Client.GDataRequestException: 'Execution of request failed: https://www.google.com/m8/feeds/contacts/default/full/38B2D4F80D96B2C2?max-results=100'

"The 'max-results' parameter is not supported on this resource"

Which is odd, since I never put in a max result parameter. Also, if it makes any difference, the Google docs show an example that takes a string url as the param for Retrieve. I could not find such an overload, the closest is what I put here, using a Uri

Anyone have any ideas how I can retrieve a single contact by id for updating?

Thanks!


Solution

  • You may refer with this documentation: Retrieving a single contact. To retrieve a single contact, send an authorized GET request to the contact's selfLink URL:

    https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}
    

    With the appropriate values in place of userEmail and contactID. Be noted that the special userEmail value default can be used to refer to the authenticated user.

    And as referred with this post, maybe you had setting.Pagesize = 100, which caused your uri to be https://www.google.com/m8/feeds/contacts/{userEmail}/full/{contactId}?max-results=100.

    Hope this helps!