Hi Alain!

Thank you very much for replying!!
Although the solution you've presented is the recommended, I haven't
had any success in using it... or not using an etag at all.

It seems that no matter the information I set in the headers, the
error it gives me is the same.

This is the output of "$xml->saveXML()" at the end of the process (the
data has already been changed for the update):

<?xml version="1.0"?> <atom:entry xmlns:atom="http://www.w3.org/2005/
Atom"><name xmlns="http://schemas.google.com/g/2005";><fullName>Diogo
Salazar - Test</fullName><givenName>Diogo</
givenName><familyName>Salazar - Test</familyName></name><email
xmlns="http://schemas.google.com/g/2005"; rel="http://
schemas.google.com/g/2005#other" address="[email protected]"
primary="true"/><phoneNumber xmlns="http://schemas.google.com/g/2005";
rel="http://schemas.google.com/g/2005#work";>11 53292700</
phoneNumber><atom:category term="http://schemas.google.com/contact/
2008#profile" scheme="http://schemas.google.com/g/2005#kind"/
><atom:id>http://www.google.com/m8/feeds/profiles/domain/qadtest.com/
full/daq</atom:id><atom:link href="https://www.google.com/m8/feeds/
photos/profile/qadtest.com/daq" rel="http://schemas.google.com/
contacts/2008/rel#photo" type="image/*"/><atom:link href="https://
www.google.com/m8/feeds/profiles/domain/qadtest.com/full/daq"
rel="self" type="application/atom+xml"/><atom:link href="https://
www.google.com/m8/feeds/profiles/domain/qadtest.com/full/daq"
rel="edit" type="application/atom+xml"/><atom:title type="text">Diogo
Salazar - Test</atom:title><atom:updated>2011-05-31T16:38:20.667Z</
atom:updated><atom:edited>2011-05-31T16:38:20.667Z</atom:edited></
atom:entry>

The updated field is "phoneNumber", all I have done was querying my
edit feed/url and modifying the selected entries.. then I tried to
'PUT' it back to Google... (as in the php code up on the first post of
this thread)...

I have no idea of what should be done! Any thoughts?

On May 31, 1:13 pm, Alain Vongsouvanh <[email protected]> wrote:
> Hello Diogo,
>
> This error means that the request is missing the
> Etag<http://code.google.com/apis/gdata/docs/2.0/reference.html#ResourceVer...>http
> header. This information is needed to ensure that your application is
> not overwriting a contact that has been updated by another application in
> the mean time.
>
> You can set the header as follow:
>
> $client->setHeaders('If-Match: <ENTRY_ETAG>');
>
> You should be able to retrieve the entry's Etag by doing something like
> this:
>
> $entry->getEtag();
>
> If you don't care about other applications changes (not recommended), you
> can use the special Etag value '*':
>
> $client->setHeaders('If-Match: *');
>
> I hope this helped!
> Best,
> Alain
>
>
>
>
>
>
>
>
>
> On Mon, May 30, 2011 at 1:43 PM, Diogo Salazar <[email protected]> wrote:
> > Hi,
>
> > I am trying to manipulate our domain user profile information.
> > I have successfully been able to retrieve profile information, but I
> > am having a hard time to edit that information...
>
> > The code for the editing of contacts follows:
>
> > <?php
> >  include "functions.php";
>
> >  checkLogin();
> > ?>
>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> >www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
> >  <body>
> > <?php
>
> >  // load Zend Gdata libraries
> >  require_once 'Zend/Loader.php';
> >  Zend_Loader::loadClass('Zend_Gdata');
> >  Zend_Loader::loadClass('Zend_Gdata_AuthSub');
> >  Zend_Loader::loadClass('Zend_Http_Client');
> >  Zend_Loader::loadClass('Zend_Gdata_Query');
> >  Zend_Loader::loadClass('Zend_Gdata_Feed');
>
> >  try {
> >    // perform login and set protocol version to 3.0
> >    $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['myToken']);
> >    $client->setHeaders('If-Match: *');
>
> >    $gdata = new Zend_Gdata($client);
> >    $gdata->setMajorProtocolVersion(3);
>
> >    $id = 'https://www.google.com/m8/feeds/profiles/domain/qadtest.com/
> > full/'.$_SESSION['uname'];
>
> >    // perform query and get result feed
> >    $query = new Zend_Gdata_Query($id);
> >    $entry = $gdata->getEntry($query);
> >    $xml = simplexml_load_string($entry->getXML());
>
> >    if($_GET['type'] == "e"){
> >      foreach($xml->email as $email){
> >        if($email['address'] == $_GET['value']){
> >          $email['address'] == $_GET['upd'];
> >        }
> >      }
> >    }else if($_GET['type'] == "p"){
> >      foreach($xml->phoneNumber as $phone){
> >        if($phone == $_GET['value']){
> >          $phone == $_GET['upd'];
> >        }
> >      }
> >    }
>
> >    /*echo $_GET['type']."<br>";
> >    echo $_GET['value']."<br>";
> >    echo $_GET['upd']."<br>";*/
>
> >    // update entry
> >    $entryResult = $gdata->updateEntry($xml->saveXML(),
> >      $entry->getEditLink()->href);/*
>
> >    echo 'Entry updated';
>
> >  }catch (Exception $e){
> >    die('ERROR:' . $e->getMessage());
> >  }
> > ?>
> >  </body>
> > </html>
>
> > The values passed on the URL from the previous page are "type" ('e'
> > for email and 'p' for phone), "value" (the original value for that
> > field; could not find a key to lookup values... if someone knows a
> > better way...) and "upd" which is the updated value for that field.
>
> > I'm still trying to learn how to manipulate data using Google's API...
> > so the page is not near a finished state....
>
> > I'm getting this error: "ERROR:Expected response code 200, got 500 No
> > ETag attribute found on an update request"
>
> > Any ideas? Thanks in advance!
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html
>
> --
> Alain Vongsouvanh

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html

Reply via email to