Thanks Trevor! That info was extremely helpful.
On Mar 4, 3:05 am, Trevor Johns <[email protected]> wrote: > 2009/2/28 ankit <[email protected]>: > > > > > > > I was trying to get all the events in a calendar using the JavaScript > > API. But, eventually, I found out that I could only get max. 25 events > > in an array. Maybe it's the limitation of the size of an array in > > JavaScript? > > > Is there any way I can obtain all the events in one go so that I can > > reduce the no. of API calls I have to make? > > > Here is what I did: > > > function getEvents(){ > > > var events =[]; > > var feedUri = 'http://www.google.com/calendar/ > > feeds/'+calendarId+'/private/full'; > > var query = new > > google.gdata.calendar.CalendarEventQuery(feedUri); > > var handleError = function(error) { > > content.innerHTML='Oops!Something went wrong!'; > > } > > > var callback = function(root){ > > events.length=0; > > events = root.feed.getEntries(); > > } > > calendarService.getEventsFeed(query, callback, > > handleError); > > } > > You're running into paging. To reduce the size of feeds, we cap them > at 25 entries (in the case of Calendar) and provide a link to get the > next batch as a <link rel="next" .../> entry (you can get an array of > all the links by calling events.getLinks()). > > You can ask the server to send you more than 25 events by setting the > max-results query parameter: > > var feedUri = > 'http://www.google.com/calendar/feeds/'+calendarId+'/private/full?max-... > > However, keep in mind that requesting large feeds can decrease the > responsiveness of your application. > > Also, max-results is just a suggestion, the server is not guaranteed > to honor it. For this reason, you should still implement code to > follow next links even when using this parameter. > > -- > Trevor Johns --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
