Hi there
I am trying to use the Google calendar API to add an event to my
calendar. I got the session key by using the AuthSub API. But when I
try to create an event using that key, I get the following error:
Expected response code 200, got 400

My code is as follows:
        $client = Zend_Gdata_AuthSub::getHttpClient($session);
        $service = new Zend_Gdata_Calendar($client);
        $event= $service->newEventEntry();

        // Populate the event with the desired information
        // Note that each attribute is crated as an instance of a
matching class
        $event->title = $service->newTitle("Title");
        $event->where = array($service->newWhere("Location"));
        $event->content = $service->newContent("Description");

        $start = time();
        $end = time()+ 3600;

        $when = $service->newWhen();
        $when->startTime = date('Ymd\THi00', $start);
        $when->endTime = date('Ymd\THi00', $end);
        $event->when = array($when);

        // Upload the event to the calendar server
        // A copy of the event as it is recorded on the server is
returned
        $newEvent = $service->insertEvent($event);

The last line throws the exception.
I did a tcpdump and found the content of the POST was as follows (I
have stripped off the session ID and token):

POST /calendar/feeds/default/private/full?gsessionid=<SESSION_ID> HTTP/
1.1
Host: www.google.com
Connection: close
Accept-encoding: gzip, deflate
Content-type: application/atom+xml
User-agent: MyCompany-MyApp-1.0 Zend_Framework_Gdata/1.5.1
authorization: AuthSub token="<TOKEN>"
Content-length: 334

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom";><atom:title
type="text">test</atom:title><atom:content type="text">test</
atom:content><gd:when xmlns:gd="http://schemas.google.com/g/2005";
startTime="20080418T113000" endTime="20080418T123000"/><gd:where
xmlns:gd="http://schemas.google.com/g/2005"; valueString="test"/></
atom:entry>

Any idea what I am doing wrong here?
Would appreciate any and all help
Thanks
Balaji

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" 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-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to