11 messages in com.googlegroups.google-calendar-help-dataapiHelp Adding event with Perl
FromSent OnAttachments
Gk30 Aug 2006 17:04 
Simon Wistow30 Aug 2006 23:09 
Gk31 Aug 2006 07:41 
Woodrow Hill31 Aug 2006 08:05 
Gk31 Aug 2006 11:09 
Woodrow Hill31 Aug 2006 12:20 
Simon Wistow31 Aug 2006 12:58 
Simon Wistow31 Aug 2006 13:06 
Gk31 Aug 2006 14:42 
Simon Wistow31 Aug 2006 16:43 
Gk31 Aug 2006 17:46 
Subject:Help Adding event with Perl
From:Gk (k.@swarthmore.edu)
Date:08/30/2006 05:04:23 PM
List:com.googlegroups.google-calendar-help-dataapi

I'm a newbie to programming with Google APIs and can't figure out why the following doesn't work and wondered if anyone here could help. (I get a 400 Bad Request error.)

use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->agent("MyApp/0.1 ");

# Create a request my $req = HTTP::Request->new(POST => 'http://www.google.com/calendar/feeds/default/private/full'); $req->header(Authorization => "GoogleLogin auth=xxxxxx"); $req->content(<<EOT); <entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'> <category scheme='http://schemas.google.com/g/2005#kind'

term='http://schemas.google.com/g/2005#event'></category> <title type='text'>Tennis with Beth</title> <content type='text'>Meet for a quick lesson.</content> <author> <name>Gk</name> <email>xxxx@gmail.com</email> </author> <gd:transparency value='http://schemas.google.com/g/2005#event.opaque'> </gd:transparency> <gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'> </gd:eventStatus> <gd:where valueString='Rolling Lawn Courts'></gd:where> <gd:when startTime='2006-09-10T08:00:00.000Z' endTime='2006-09-10T10:00:00.000Z'></gd:when> </entry> EOT

# Pass request to the user agent and get a response back my $res = $ua->request($req);

# Check the outcome of the response if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; }