error: getting incorrect data version on updating acl entry (zend/php)

136 views
Skip to first unread message

Peter Brachwitz

unread,
Mar 29, 2012, 7:29:36 AM3/29/12
to google-docum...@googlegroups.com
Hello,

I'm trying to perform a PUT request to change the role of a user in my acl list.

this is the code/xml submitted: 

        $entry = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007"' . 
        ' xmlns:gd="http://schemas.google.com/g/2005"' .
        ' gd:etag=\'W/"CUUNSXYyfCp7ImA9WxRVGUo."\'>' .
        '<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/>' .
        '<gAcl:role value="' . $permission . '"/>' .
        '<gAcl:additonalRole value="commenter"/>' .
        '<gAcl:scope type="user" value="' . $email . '"/>' .
        '</entry>';    

$client->setRawData($entry, 'text/xml');
        $response = $client->request('PUT');
        var_dump(simplexml_load_string($response->getBody())); die(); 
 
The version is specified in the header. The response I'm getting is as follows: 

object(SimpleXMLElement)[563]
  public 'error' => 
    object(SimpleXMLElement)[564]
      public 'domain' => string 'GData' (length=5)
      public 'code' => string 'incorrectDataVersion' (length=20) 
public 'internalReason' => string 'Entry has incompatible service version. Expected:3, Actual:2' (length=60)

I don't see what I'm doing wrong, since I copied the xml string from the document list API.

Any help on what is going wrong here is greatly appreciated.  
 

Ali Afshar

unread,
Mar 29, 2012, 10:57:13 AM3/29/12
to google-docum...@googlegroups.com
Hi Peter,

I am guessing a bit, but I think the service is hard-coded to setting GData-Version: 2.0 header, which will need to be changed to 3.0. Since the Zend library is not in our control, it is a bit hard for us to fix. You can confirm by dumping the headers you are sending?

Thanks
--
Ali Afshar | www.googplus.org/ali | Google Developer Relations

Peter Brachwitz

unread,
Mar 29, 2012, 12:18:34 PM3/29/12
to google-docum...@googlegroups.com
This is actually my first time using Zend, and I wasn't using the library, I wrote the function myself, but the header is as follows:

$headers = array(
                'GData-Version' => '3',
                'Content-Type' => 'application/atom+xml'
            );

if I change the version to 2 (using the header or a get parameter v=3, it returns that the request URI is invalid. 

Op donderdag 29 maart 2012 16:57:13 UTC+2 schreef Ali Afshar het volgende:

Peter Brachwitz

unread,
Apr 3, 2012, 6:09:52 AM4/3/12
to google-docum...@googlegroups.com
I now also tried different ways to specify the header information:

setParameterGet('v', '3'); <-- didn't work
$headers = array(
                'GData-Version' => '3.0',    <-- added the .0, same error
                'Content-Type' => 'application/atom+xml'
            );

$headers = array(
                'GData-Version' => 3.0,  <--- now not as string, same error
                'Content-Type' => 'application/atom+xml'
            );

$headers = array(
                'GData-Version' => '2.0',    <--- invalid request uri
                'Content-Type' => 'application/atom+xml'
            );

I think I've attempted every possibility now, but I'm sure that the correct version number is sent (again, as I don't use the zend library) Is there possibly an error in the API? because the granting/revoking access works normally, just updating the acl gives me this error.

Op donderdag 29 maart 2012 16:57:13 UTC+2 schreef Ali Afshar het volgende:
Hi Peter,

Ali Afshar

unread,
Apr 3, 2012, 10:17:17 AM4/3/12
to google-docum...@googlegroups.com
Hi Peter,

Can you print the XML of the entry you are putting after the variables have been interpreted please?

Regards

Peter Brachwitz

unread,
Apr 4, 2012, 5:40:08 AM4/4/12
to google-docum...@googlegroups.com
var_dumped the xml variable right before submitting. 

string '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gAcl="http://schemas.google.com/acl/2007" xmlns:gd="http://schemas.google.com/g/2005" gd:etag='W/"CUUNSXYyfCp7ImA9WxRVGUo."'><category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/acl/2007#accessRule"/><gAcl:role value="writer"/><gAcl:additonalRole value="commenter"/><gAcl:scope type="user" value="pfb...@gmail.com"/></entry>' (length=413)

Op dinsdag 3 april 2012 16:17:17 UTC+2 schreef Ali Afshar het volgende:
Reply all
Reply to author
Forward
0 new messages