I am getting exactly 1000 contacts back in my request. And, many of my more important contacts are not in the list - people I email frequently. I might be doing something foolish on my end, but I am getting a list of contacts, just not all the ones I am expecting. I really appreciate anyone's insight!
In case it is useful, here is the php function I am using to do the retrieval:
public static function contactsForUser($userIdToken)
{
$result = array();
if (!empty($userIdToken)) {
$request = '/users/' . $userIdToken . '/contacts.json';
$json = SocialLogin::siteRequest($request);
if (!empty($json->error)) {
/// ???
Log::logDebug(' error requesting data: ' . $json->error);
}
else {
//Extract data
$data = $json->response->result->data;
//Check for service
if ($data->identities->count > 0) {
//Log::logDebug('num identities: ' . count($data->identities->entries));
foreach ($data->identities->entries as $identity) {
// extract contacts from this identity...
$contacts = $identity->contacts->entries;
Log::logDebug('num contacts: ' . count($contacts) . ' count ' . $identity->contacts->count);
if (is_array($contacts)) {
foreach ($contacts as $contact) {
$contactDetails = array();
if (count($contact->emails) > 0) {
$e = $contact->emails[0];
$contactDetails['email'] = (string)$e->value;
if (!empty($contact->name)) {
$contactDetails['name'] = (string)$contact->name->formatted;
//Log::logDebug('contact name ' . $contactDetails['name']);
}
//Log::logDebug('contact email ' . $contactDetails['email']);
$result[] = new Contact($contactDetails);
}
}
}
}
Log::logDebug('found ' . count($result) . ' contacts ');
}
}
}
return $result;
}
Answers
thanks!!
Unless there was a way to sort those contacts by most used (frequently contacted contacts first).
This should be fixed now. Are you still limited to the 1000 contacts?
Regards.