You don't want to use futureevents=true as that will return _all_
future events without regard to any other date parameters.

The complete list of query parameters is here:
http://code.google.com/apis/calendar/docs/2.0/reference.html#Parameters

You probably want to specify start-min sometime in the recent past and
start-max as whatever works best with your typical distribution of
events. If normally have several events a day, the start-max could  be
tomorrow, but with a different distribution of events, you might want
it to be next week.

Then add in orderby=starttime, and sortorder=a and you'll get the feed
that you seem to want. Make your work easier by using
singleevents=true to expand recurrent events.

You will probably need to add some logic on the Perl side to select
the one event that you want to display (what if two events start at
the same time?, what if there is one event that lasts this week and
another that lasts all day today) but if that doesn't happen with for
your events, the you could also use max-results=1.

Hope that helps,

Ray


On Mon, Jun 1, 2009 at 3:40 PM, Michael
Darling<[email protected]> wrote:
>
> I'm attempting to write a Perl bot that checks if there is a current
> event on a calendar. If so, it will display information about the
> event in an IRC channel.
>
> As such, I'd like to use the feed to get the nearest present/future
> event to the current date. I've tried the following:
>
> http://www.google.com/calendar/feeds/xxxxxxxxxxx/private/basic?futureevents=true&orderby=starttime&sortorder=ascending&max-results=1
>
> However, this gives me the earliest possible event - ie. an event
> which has already passed. If I use sortorder=descending, I am given
> the latest non-recurring event - which is in 2012. If I remove
> futureevents=true, I receive entirely different results. I'm using
> both recurring and non-recurring events, which seems to be causing
> part of the problem.
>
> Does anyone have any idea what I'm doing wrong?
> Thanks.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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