For some reason i am getting events back from 2010 that are returning in this API call:
https://www.googleapis.com/calendar/v3/calendars/myEmailHere@gmail.com/events?>maxResults=15&key={KEY HERE}
Use the timeMin parameter query in your URL. By default you don't filter by date, so you just get all results. Filtering maxResults just limits the amount of events returned.
I have had evens all the way up till now (2014). The API is also showing that it was >update in the 1900s???.
Problably because the event has never been updated. It isn't documented in the API: https://developers.google.com/google-apps/calendar/v3/reference/events/list
Also, another thing i thought was weird. Google Calendar also returns two different >dates?! a dateTime and a date. (Dependent on a All Day Event). Is this supposed to happen? >It makes developers have to check which one was sent in the response and then parse the >date dependent upon that. Either that, or i am missing a parameter in my request.
Yes, this is supposed to happen according to the documentation. https://developers.google.com/google-apps/calendar/v3/reference/events#resource
The date, in the format "yyyy-mm-dd", if this is an all-day event.
The time, as a combined date-time value (formatted according to RFC 3339). A time zone >offset is required unless a time zone is explicitly specified in timeZone.
For myself, I have been strugling with getting everything to work as well, so I hope this helped you out.
As for deserializing. I used Newtonsoft.JSON to deserialize the appointment in .NET. First make a root object, because you are serializing a list of events.
public class RootObject
{
public RootObject() {}
//parameters you want to retrieve from the Calendar.
public List<GoogleEvent> events {get;set;}
}
public class GoogleEvent
{
public GoogleEvent(){}
[JsonProperty("calendarId")] //specify which JSON parameter needs to be mapped
public string Id {get;set;}
//all parameters you need
}
then use the NewtonSoft deserializer to get the RootObject which containt all events from the Json you retrieved.
NewtonSoft.Json.JsonConvert.DeserializeObject<RootObject>(JSONSTRING);