1
I am using the Google People API and need to do a bulk removal operation (delete). I took a look at their documentation, but I couldn’t find any way to delete all contacts from the agenda or a particular group (like sending a batch, for example).
I saw that there was a way to remove all contacts from a particular group when I deleted the group itself. I implemented this, but it didn’t work. In fact, it didn’t even work on itself Dashboard from google. However, their contact manager works.
I tried to inspect the requests, but it didn’t go very well either. My implementation is like this:
/**
* Delete a group
* @param $resourceName //Group resource name
* @param $deleteContacts //Verify if it should delete the members
* @return Object
*/
public function deleteGroup($resourceName, $deleteContacts = false) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://people.googleapis.com/v1/'.$resourceName.'?deleteContacts='.($deleteContacts ? 'true' : 'false'));
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Bearer ' . $this->access_token));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
Does anyone have any idea what I could do?