3 messages in com.googlegroups.google-calendar-help-dataapiRe: Quick Add Event Default Behavior
FromSent OnAttachments
nicodotti220 Jun 2008 09:28 
Austin (Google)23 Jun 2008 09:32 
nicodotti224 Jun 2008 16:51 
Subject:Re: Quick Add Event Default Behavior
From:nicodotti2 (nico@gmail.com)
Date:06/24/2008 04:51:40 PM
List:com.googlegroups.google-calendar-help-dataapi

Event Edit URLs:

Another thing I was having trouble with but was able to solve (I emailed Austin directly--perhaps I should have posted a new topic) was getting the proper edit url for updates, reminders, etc. via event.GetEditLink().href It seems this is a recurring theme and very important to be able to do antying useful after a query (update, delete, remind, etc.) I was having trouble getting the event object by id via a private function and getting Invalid URI errors. It turned out that I had the event instantiation was somehow wrong. This is what I changed and it now works:

The event id would be something like: http://www.google.com/calendar/feeds/default/private/full/bjf2smarg7kqpfuqoi9q1ktc1c and returned from a previous query.

#event = self.aerioGetEventById(reusableToken, eventId) # THIS CALLS THE FUNCTION BELOW BUT DOES NOT WORK event = calendar_service.GetCalendarEventEntry(eventId) # THIS DOES WORK

def aerioGetEventById(self,reusableToken,eventId): """ This ain't working!!!""" try: logging.debug('aerioGetEventById-event id: %s' % eventId ) calendar_service = self.__getCalendarServiceObject(reusableToken) feed = calendar_service.GetCalendarEventFeed() for i, an_event in zip(xrange(len(feed.entry)), feed.entry): if(an_event.id.text==eventId): return an_event

except gdata.service.RequestError, request_error: # They aren't logged in? if request_error[0]['status'] == 401: logging.error('aerioGetEventById-401 error: %s ' % (str(request_error[0]))) else: logging.error('aerioGetEventById-Error: %s ' % (str(request_error[0])))

return None # error and couldn't get event so return None else: return None # no error, but no match either or else we wouldn't have got here - return None

On Jun 23, 9:32 am, "Austin (Google)" <api.@google.com> wrote:

Hi,

1) It does appear that when using "quick add" to create event and without having any semantic cue to determine the time of the event, it is assumed to be an event of the current time.

2) On this page you can find the common error status codes and their description -

http://code.google.com/apis/gdata/reference.html#http-status-codes

Hope it helps, Austin

On Fri, Jun 20, 2008 at 9:28 AM, nicodotti2 <nico@gmail.com> wrote:

Hello all,

I've been working the create event call using the python client api and I noticed something strange and have some questions. Here's the code and the result:    nonsensicalEvent = 'otigleedinglodinglodin'    quickAddEvent = {'quickAddEventData':nonsensicalEvent}    #quickAddEvent = {'quickAddEventData':'lunch with John at "Taco Tuesdays" Monday 12 pm'}    #quickAddEvent = {'quickAddEventData':'Tennis with Roger Federer June 21 3pm-5:15pm'}    test_aerioQuickAddEvent(quickAddEvent, reusableToken) When I run the uncommented portion above (btw, the others work fine), I actually got an event for the current day at 9:14am otigleedinglodinglodin

So my questions: 1. What's the 'default' behavior on an event that doesn't specify a true 'When' and why did I get an event at 9:14 (by the way, that was about the time I ran the program - so will it always create an event right now?)

2. Is there a concept of an invalid event? If so can I see an example? I'd like to try to exercise exceptional conditions. 2b. Also, as I'm new to the gdata api, is there a document that goes into various example exceptional conditions for all the calendar services? I've already looked at the code: On failure, a RequestError is raised of the form:            {'status': HTTP status code from server,            'reason': HTTP reason from the server,            'body': HTTP body of the server's response} But is there more documentation available on this?

Thanks all. You can skip the following question but just in case: Is this a good way of handling exceptions in general?

       try:            # Send the request and receive the response:            logging.debug('aerioQuickAddEvent-About to add quick add event (calling gdata feed)')            new_event = calendar_service.InsertEvent(event, '/calendar/ feeds/default/private/full')

       except RequestError, request_error:            # They aren't logged in?            if request_error[0]['status'] == 401:                logging.debug('aerioQuickAddEvent-401 error: %s ' % (str(request_error[0])))            else:                logging.debug('aerioQuickAddEvent-Error: %s ' % (str(request_error[0])))

           return {'addedEvent':'Error (see log files)'}        else:            # We only get here if we pass the try            return {'addedEvent':'True'}