1 year ago
#310750
David
How can I return user defined contact groups from the google people API using a curl request?
Using the Google Developer Api Tool I have been able to execute a blank query and return a list of contact groups, exactly as expected. When using the same cURL request from my PHP app I don't get anything but some system contact groups (and not all overlap with the tool's response). I can't figure out why this would be the case, am I missing something really obvious?
The Curl Request c&p'd from the google developer tool:
curl \
'https://people.googleapis.com/v1/contactGroups?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
And my php cURL request:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://people.googleapis.com/v1/contactGroups");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = ["Authorization: Bearer {$access_token}", "Accept: application/json"];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$data = curl_exec($ch);
$result = json_decode($data, true);
var_dump($result); die();
The returned outputs of the requests are in the same format, just the content differs. Does anyone have experience trying to get a list of contact groups/labels from the people api?
php
rest
curl
google-people-api
0 Answers
Your Answer