'Google People API - get contact details (batch)
Using Google People API, one can get a contact detail by its ID.
"https://people.googleapis.com/v1/" + id + "?key=" + <KEY> + "&personFields=addresses,clientData,emailAddresses,names,organizations,phoneNumbers,birthdays",
Is it possible to get such details in batch? I have a list of 100 contact ids and I want them to get at once as it'd be much faster.
Solution 1:[1]
In your situation, how about using the method of "Method: people.getBatchGet"? When this method is used, the 200 resource names (maximum number) can be retrieved by one API call. When this is used for your situation, it becomes as follows.
Sample curl command:
curl \
'https://people.googleapis.com/v1/people:batchGet?personFields=addresses%2CclientData%2CemailAddresses%2Cnames%2Corganizations%2CphoneNumbers%2Cbirthdays&resourceNames=people%2Fsample1&resourceNames=people%2Fsample2&resourceNames=people%2Fsample3' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
- In above case, the unencoded endpoint is
https://people.googleapis.com/v1/people:batchGet?personFields=addresses,clientData,emailAddresses,names,organizations,phoneNumbers,birthdays&resourceNames=people/sample1&resourceNames=people/sample2&resourceNames=people/sample3
. - Also, you can test this with "Try this API". Ref
Reference:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Tanaike |