I have been trying to delete contacts and my script so far is below

// creditials
$client = Zend_Gdata_ClientLogin::getHttpClient($email,
$password,"cp");
$gdata = new Zend_Gdata($client);

// updates all the contacts that hav google ids
// Using Client Login
$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/
contacts/' . $email . '/full');
$query->setMaxResults(1000);
$feed = $gdata->getFeed($query,'Zend_Gdata_App_Feed');


foreach ($feed->getEntry() as $entry )
{
        $google_id = $entry->getId()->getText(); // give the feed url ie
http://www.google.com/m8/feeds/contacts/wsapyouth%40gmail.com/base/347f1993088406f4

        // remove contact if there isn't a result from the database
        $client->$google_id;
        $http_response = $client->request('DELETE');
}

any suggestions?
Thanks in advance!

On Feb 25, 1:40 am, "Julian (Google)" <[email protected]> wrote:
> Hi,
>
> I think the problem in your request is the Content-Type, when a GET is
> perform it should be application/x-www-form-urlencoded because there
> is not XML been send in the content. Here is an example:
>
> DELETEhttp://www.google.com/m8/feeds/groups/user%40domain.com/full/66a1a207...
> Authorization: GoogleLogin auth=DQA...
> If-Match: *
> Content-Type: application/x-www-form-urlencoded
> GData-Version: 2
>
> Cheers,
> Julian
>
> On Feb 23, 2:45 pm, Tiago Macedo <[email protected]> wrote:
>
> > I've resorted to debugging using telnet and I've tried all sort of
> > combinations of headers without any success. If I do everything by the
> > book I get the Unexpected resource version, if I remove the GData-
> > Version and If-Match headers I get a 409 conflict when i try todelete
> > the group (which I found somewhat weird).
>
> > I also tried using the X-HTTP-Method-Override:DELETEjust in case I
> > was getting bitten by a proxy somewhere in the line but I get the
> > exact same behaviour.
>
> > On Feb 23, 2:56 pm, Tiago Macedo <[email protected]> wrote:
>
> > > I'm assuming the HTTP header names are case insensitive (as specified
> > > in the RFC) namely the GData-Version header (which my HTTP library is
> > > sending as Gdata-Version).
>
> > > On Feb 23, 12:40 pm, Tiago Macedo <[email protected]> wrote:
>
> > > > Obviously I'm also sending the Authorization header :)
>
> > > > Thanks for the help,
> > > > Tiago
>
> > > > On Feb 23, 12:29 pm, Tiago Macedo <[email protected]> wrote:
>
> > > > > I'm migrating an existing application to the version 2 of the Contacts
> > > > > API and I can't seem todeletegroups.
>
> > > > > I'm fetching the group "edit" URI, something 
> > > > > likehttp://www.google.com/m8/feeds/groups/XXXXXXXXX%40gmail.com/full/XXXX...
> > > > > and then issuing an HTTPDELETEwith the following headers:
>
> > > > > Content-Type: application/atom+xml
> > > > > GData-Version: 2
> > > > > If-Match: *
>
> > > > > I've also tried using the group etag instead of * but I always get the
> > > > > same "Unexpected resource version ID"
>
> > > > > And no, I'm not using cached URIs from v1, the reply I get from the
> > > > > API when I fetch the group list is something like:
>
> > > > > <entry
> > > > > gd:etag="&quot;QXc8cTVSLyp7ImA9WxVWEU8MQQE.&quot;">
> > > > >       <id>http://www.google.com/m8/feeds/groups/XXXXXXXXX%40gmail.com/
> > > > > base/XXXXXXXXXXXXXX</
> > > > > id>
> > > > >       <updated>2009-02-20T10:44:10.979Z</
> > > > > updated>
> > > > >       <app:edited xmlns:app="http://www.w3.org/2007/
> > > > > app">2009-02-20T10:44:10.979Z</
> > > > > app:edited>
> > > > >       <category scheme="http://schemas.google.com/g/2005#kind";
> > > > > term="http://schemas.google.com/contact/2008#group"/
>
> > > > >       <title>Group 1</
> > > > > title>
> > > > >       <content>Group 1</
> > > > > content>
> > > > >       <link rel="self" type="application/atom+xml" 
> > > > > href="http://www.google.com/m8/feeds/groups/XXXXXXXXXXXX%40gmail.com/full/X......"/>
> > > > >       <link rel="edit" type="application/atom+xml" 
> > > > > href="http://www.google.com/m8/feeds/groups/XXXXXXXXXXXX%40gmail.com/full/X......"/>
> > > > >       <gd:extendedProperty
> > > > > name="XXXXXXXXXXXXXx">
> > > > >     <info>XXXXXXXXXXXXX</
> > > > > info>
> > > > >   </
> > > > > gd:extendedProperty>
> > > > >     </entry>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to