ZF-10194: Can't delete an entry from Google services using Gdata->delete method - client headers not taken into account ?
Trying to create/update/delete contacts from Google contacts. Know there's no classes as they already exist for others services, but i am using gdata Zend_Gdata_Query class to directly retrieve contacts, gdata->updateEntry() to update a contact
Last action is how to delete a contact.
Looked the documentation (http://files.zend.com/help/Zend-Framework/…) But it didn't work : Got a 403 error with error message "If-Match or If-None-Match header or entry etag attribute required"
Steps to reproduce issue:
Try to delete contact with this php code : $client = Zend_Gdata_ClientLogin::getHttpClient($login,$pass,'cp'); $client->setHeaders("If-Match: *"); $gdata = new Zend_Gdata($client); $gdata->setMajorProtocolVersion(3); $gdata->setMinorProtocolVersion(null);
$gdata->delete('http://google.com/m8/feeds/…('@', '%40', $user->google_email).'/full/'.$synchContacts->idgoogle);
I also tried to retrieve the entry and delete it directly - same result ! $query = new Zend_Gdata_Query('http://google.com/m8/feeds/…('@', '%40', $user->google_email).'/full/'.$synchContacts->idgoogle); $entry = $gdata->getEntry($query); $entry->delete();
I tried on zend framework 10.2 and 10.5 same behavior
I tried to downgrade to protocol version 1, it was working last month but now it isn't anymore. How can we check with Zend or Google if there's some changes in the apis ?
I tried downgrading to protocol V1 but it didn't work as well. Why the setHeaders instruction is not correctly take into account by Google servers ?
I captured the network traffic and don't see the header If-Match I wrote in the code. Is it taken into account ?
Contact deleted, with answer 200 from Google
Here is the network traffic recorded between my app and google servers :
My App packet :
DELETE /m8/feeds/contacts/demococea%40captivea.fr/full/308d6f698f2e8298 HTTP/1.1 Host: www.google.com Connection: close User-Agent: MyCompany-MyApp-1.0 Zend_Framework_Gdata/1.10.2 authorization: GoogleLogin auth=DQAAAJ8AAABGra3kyGKzGO_Gpy8ULHhnr3irCWGXcIMsNFL0s5qCoS4ss3O2EHQ8oH5uVvdXI4HX6s9lNfdymnZwrmjCgtPX6KD1YAGtz2AL3cKHWYYGQjLr9xJWoy1Bg_w3x-AzJ21jDeDVltN6Im8gtZDfo0dGx5AGQ9IicTlNiqUvc_17nNOPDSTMQXpDXVoZxqX7OcK_dUJSXoUwPPVcGRlykz9H GData-Version: 3 Accept-encoding: identity Content-Type: application/atom+xml Content-Length: 0
Answer from Google :
HTTP/1.1 403 Forbidden Content-Type: text/html; charset=UTF-8 Date: Wed, 21 Jul 2010 09:56:32 GMT Expires: Wed, 21 Jul 2010 09:56:32 GMT Cache-Control: private, max-age=0 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Connection: close If-Match or If-None-Match header or entry etag attribute required