0

I have been struggling with an issue when I try to retrieve all the domain shared contacts using the shared contacts API

According to this page: https://developers.google.com/admin-sdk/domain-shared-contacts/#Retrieving The API for retrieving ALL the domain shared contacts is:

GET https://www.google.com/m8/feeds/contacts/example.com/full

My issue is, when I implement this call in my app, it does not return all the contacts, instead it does return a portion on the contacts I have...

For example, I have created about 200 shared contacts using the API, And I CAN SEE them when I want to type a new email or browse the directory, but when I use the API call to retrieve all those 200 contacts, I can only get about 20-30 of them in the returned result...

I have tried these combinations of commands:

wget https://www.google.com/m8/feeds/contacts/DOMAINNAME_COM/full?access_token=ACCESS_TOKEN

curl -i https://www.google.com/m8/feeds/contacts/DOMAINNAME_COM/full -H "Authorization: Bearer ACCESS_TOKEN"

And even a direct request from the browser by typing the API call in the address bar like this:

https://www.google.com/m8/feeds/contacts/DOMAINNAME_COM/full?access_token=ACCESS_TOKEN

But I still did only get like 20-30 entries of the whole ~200 contact objects...

I really appreciate any help and guidance on this as I am getting little bit frustrated about this...

Regards
Saleh

Bluescrod
  • 81
  • 1
  • 7

1 Answers1

1

For obtaining this you could use max-results query parameter in Retrieving contacts using query parameters. However there are some constraints that apply to the Shared Contacts Data API. The response will be truncated if it exceeds 10MB in length.

Note: The feed will not return more than 10MB in a single response. Attempts to do so will result in truncated data. For information on limiting the number of results returned, see the max-results query parameter in Retrieving contacts using query parameters. You can retrieve the entire contact list by repeatedly following the returned feed's next link, until no such link can be found.

So basically you should do several requests in order to get all the contacts using the max-results query parameter and the feed's next link.

Hope that helps!

KRR
  • 4,647
  • 2
  • 14
  • 14
  • Much appreciated! it worked and it was my bad for not reading more on this topic. I ended up with this line and things were very fine: `curl -i -s https://www.google.com/m8/feeds/contacts/$domainName/full?max-results=xx -H "Authorization: Bearer $accessToken"` – Bluescrod Aug 12 '15 at 08:46