Hello Diogo,

This error means that the request is missing the
Etag<http://code.google.com/apis/gdata/docs/2.0/reference.html#ResourceVersioning>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