0

I'm trying to create an empty Spreadsheet using Gdata API. As I've reached the same problem as this other friend here (http://goo.gl/AHT7S) the default Zend API do not support this operation. So, I'm trying to implement it.

Actually I fell we almost got it, but I have this answer from google service: 403 - <errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>ServiceForbiddenException</code><internalReason>You do not have permission to perform this operation.</internalReason></error></errors>

I'm using the most simple way of doing it: client login + Zend_GData functions. My code goes like this (please forgive any dumb thing... I'm new in PHP and GData):

public function newSpreadsheet($name){

            $line = "\n";
            $tab = "\t";
            $token = 'GoogleLogin auth=' . $this->login->getLoginToken();

            $headers = array();
            $headers['GData-Version'] = "3.0";
            $headers['Authorization'] = $token;
            $headers['Content-Length'] = '287';
            $headers['Content-Type'] = 'application/atom+xml';

            $url = 'https://docs.google.com/feeds/default/private/full';

            $body = "<?xml version='1.0' encoding='UTF-8'?>".$line;
            $body .= "<entry xmlns='http://www.w3.org/2005/Atom'>".$line;
            $body .= $tab. "<category scheme='http://schemas.google.com/g/2005#kind'".$line;
            $body .= $tab.$tab."term='http://schemas.google.com/docs/2007#document'/>".$line;
            $body .= $tab."<title>".$name."</title>".$line;
            $body .= "</entry>";

            echo $body;

            return parent::performHttpRequest('POST',$url,$headers,$body);
}

Is there any idea on why I "do not have permission" to execute the operation?

Nigini
  • 454
  • 1
  • 5
  • 16

1 Answers1

1

Perhaps, you want to try to upload an empty spreadsheet using the API, instead of performing a HTTP request.

See more details here:

http://code.google.com/apis/documents/docs/1.0/developers_guide_php.html#UploadingSpreadsheet

elizeu
  • 96
  • 4
  • There it is Elizeu. As I told, I'm new on this and this "upload tool" was not examined. I've got it working and then I can continue my software. I'll not mark this as the right answer because maybe someone can help with the above code implementation. But I really appreciate your help. – Nigini Sep 02 '11 at 12:02