Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I retrieve emails addresses and phone numbers with Google People API?

I want to retrieve my contacts names, email address and phone numbers using the Google People API and I'm using their Try it! tool to test the API.

The names are being retrieved but not the emails addresses and phone numbers. I think I'm doing everything correctly. I'm properly authenticated with the proper scopes and selected fields. enter image description here enter image description here

Am I doing something wrong? Or maybe this is an issue on Google's side?

like image 904
nunoarruda Avatar asked Apr 07 '16 03:04

nunoarruda


2 Answers

I have found a solution. According to the Google People API docs omitting this RequestMask field will include all fields but that's not happening. In my case setting the RequestMask field to person.names,person.emailAddresses,person.phoneNumbers works.

like image 172
nunoarruda Avatar answered Oct 21 '22 04:10

nunoarruda


You have to use people.connections.list to fetch the list of contacts, then loop over them and use people.get in order to fetch each individual contact. In my case I set pageSize to 50 and then I use people:batchGet (which supports up to 50 resource names at a time) to fetch the details for those 50 contacts.

like image 42
Brandon Farber Avatar answered Oct 21 '22 02:10

Brandon Farber