Hi Ryan,

Having a similar problem as Trav (sharing a spreadsheet with other
contributors), I'm trying to apply your solution to my code.The
objective is to add a contributor to a newly uploaded XLS file. I've
added the function insertContributor on Docs.php as mentioned based on
insertDocument:

public function insertContributor($data, $uri,
        $className='Zend_Gdata_Docs_DocumentListEntry')
    {
        return $this->insertEntry($data, $uri, $className);
    }

My complete code can be found here: http://pastebin.com/m139d1ba8

Obviously I'm missing here, especially on a Saturday night, but I keep
getting this error:

<b>Fatal error</b>:  Uncaught exception 'Zend_Gdata_App_HttpException'
with message 'Expected response code 200, got 404
' in C:\XAMPPlite\htdocs\erepublik\library\Zend\Gdata\App.php:699
Stack trace:
#0 C:\XAMPPlite\htdocs\erepublik\library\Zend\Gdata.php(218):
Zend_Gdata_App-&gt;performHttpRequest('POST', 'http://docs.goo...',
Array, '&lt;entry xmlns=&quot;h...', 'application/ato...', NULL)
#1 C:\XAMPPlite\htdocs\erepublik\library\Zend\Gdata\App.php(885):
Zend_Gdata-&gt;performHttpRequest('POST', 'http://docs.goo...', Array,
'&lt;entry xmlns=&quot;h...', 'application/ato...')
#2 C:\XAMPPlite\htdocs\erepublik\library\Zend\Gdata\App.php(955):
Zend_Gdata_App-&gt;post('&lt;entry xmlns=&quot;h...', 'http://
docs.goo...', NULL, NULL, Array)
#3 C:\XAMPPlite\htdocs\erepublik\library\Zend\Gdata\Docs.php(262):
Zend_Gdata_App-&gt;insertEntry('&lt;entry xmlns=&quot;h...', 'http://
docs.goo...', 'Zend_Gdata_Docs...')
#4 C:\XAMPPlite\htdocs\erepublik\index.php(280): Zend_Gdata_Docs-
&gt;insertContributor('&lt;entry xmlns=&quot;h...', 'http://
docs.goo...')
#5 C:\XAMPPlite\htdocs\erepublik\index.php(2 in <b>C:\XAMPPlite\htdocs
\erepublik\library\Zend\Gdata\App.php</b> on line <b>699</b>

Any hints on this would be highly appreciated.

Thank you,
Cristi


On Apr 29, 5:44 pm, Ryan Valdron <[email protected]> wrote:
> Trav,
>
> If you're using the Zendphpapi, I wrote a method in the Docs class
>
> public function addContributor($data, $uri, $className='Zend_Gdata_Entry'){
>     return $this->insertEntry($data, $uri, $className);
>
> }
>
> that works similar to insertDocument.
> where $uri = "http://docs.google.com/feeds/acl/private/full/document%3A".$id;
> and $id is the document's ID.
>
> and $data follows this layout:
> <entry xmlns="http://www.w3.org/2005/Atom";
> xmlns:gAcl='http://schemas.google.com/acl/2007'>
>   <category scheme='http://schemas.google.com/g/2005#kind'
>     term='http://schemas.google.com/acl/2007#accessRule'/>
>   <gAcl:role value='writer'/>
>   <gAcl:scope type='user' value='[email protected]'/>
> </entry>
> as given in the developer's guide
> (http://code.google.com/apis/documents/docs/2.0/developers_guide_proto...).
>
> You could also do it in a batch run using this function (untested)
>
> public function executeBatch($data, $uri,
> $className='Zend_Gdata_App_Feed', $extraHeaders=array()){
>         $response = $this->post($data, $uri, null, null, $extraHeaders);
>
>         $returnFeed = new $className($response->getBody());
>         $returnFeed->setHttpClient(self::getstaticHttpClient());
>
>         $etag = $response->getHeader('ETag');
>         if (!is_null($etag)) {
>             $returnEntry->setEtag($etag);
>         }
>
>         return $returnEntry;
>     }
>
> in the App class. Where $data is laid out according to the link above
> and $uri is the same as above with /batch at the end of it.
>
> Either way you're going to have to adjust the scope in the Docs
> implementation from $scope = 'http://docs.google.com/feeds/documents';
> to $scope = 'http://docs.google.com/feeds/';in order for either
> function to work.
>
> -Ryan
>
>
>
> On Wed, Apr 29, 2009 at 12:21 PM, Trav <[email protected]> wrote:
>
> > Hi,
>
> > I have completed the portion of my application that uploads a document
> > to Google Docs with thePHPapi, However, I need to invite
> > collaborators to the document automatically throughPHP, how can I
> > accomplish this?
>
> > I am using Google docs on my own domain through Google Apps. The
> > collaborators that I need to invite will all be in the same domain.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data 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://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to