Remove by mass or from a group

1

I'm using the Google People API and need to do a mass delete operation. I took a look at their documentation, but I did not find any way to delete all contacts from the calendar or from a certain group (like sending a batch, for example).

I saw that there was a way to remove all contacts from a particular group when you deleted the group itself. I implemented this, but it did not work. In fact, it did not even work on the google dashboard . However, their contact manager works.

I tried to inspect the requests, but it did not work too well. My implementation looks 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;
}

Anyone have any idea what I could do?

    
asked by anonymous 11.08.2017 / 21:52

0 answers