So I've been using the REST method of invoking Google's API. I need to insert events into a particular calendar whose ID I have. This is the POST request I'm sending:
Address: https://www.googleapis.com/calendar/v3/calendars/{calendarID}/events
Body:
Authorization: Bearer {access_token}
{
"end": {
"dateTime": "2012-08-30T12:30:00",
"timeZone": "America/Chicago"
},
"start": {
"dateTime": "2012-08-30T14:00:00",
"timeZone": "America/Chicago"
},
"summary": "E E 306",
"colorId": "9"
"kind": "calendar#event"
}
And this is the response I keep getting:
{
"error":{
"errors":[
{
"domain":"calendar",
"reason":"timeRangeEmpty",
"message":"The specified time range is empty.",
"locationType":"parameter",
"location":"timeMax"
}
],
"code":400,
"message":"The specified time range is empty."
}
}
I don't understand what I could possibly be doing wrong. I've entered all necessary data, and it's asking me for a parameter that doesn't even exist for events. I also can't find any documentation out there on this particular problem. Does anyone see something I'm missing?
In the midst of asking this question, I face palmed so hard I think I've done myself brain damage. As it turns out, the reason I couldn't find any documentation on this problem was because of how spectacularly silly it was.
The reason it was giving me such a funny error was because in the copy-pasting I was doing to test, I flipped the start and end times. So, I was telling Google Calendars to enter an event that ended before it started, which generally doesn't end too well.
Long story short, if you get an error referring to the "timeMax" parameter while trying to insert an event, check your start and end times.