title: How can I add an event to a Google calendar using v3 API and JQuery?
body: <p>I am attempting to teach myself some JQuery/REST/Google API by putting together a simple page that does the following:</p>
  
  <ol>
  <li>Authenticates with Google </li>
  <li>Validates a token</li>
  <li>Gets a list of Google Calendars for the user</li>
  <li>List events for a selected calendar</li>
  <li>Add an event for a selected calendar</li>
  </ol>
  
  <p>I have #1 through #4 working (although no doubt in an ugly manner), and am getting tripped up on #5.  Here's the JQuery ajax call:</p>
  
  <pre><code>var url = 'https://www.googleapis.com/calendar/v3/calendars/[MY_CALENDAR_ID]/events?sendNotifications=false&amp;access_token=[GOOGLE_API_TOKEN]';
              var data = { end: { dateTime: "2012-07-22T11:30:00-07:00" }
                              , start: { dateTime: "2012-07-22T11:00:00-07:00" }
                              , summary: "New Calendar Event from API"
                          };
  
              var ajax = $.ajax({ url: url
                                  , data: data
                                  , type: 'POST'
                          }).done(addEventDone)
                            .fail(function (jqHXR, textStatus) {
                                console.log("addEvent(): ajax failed = " + jqHXR.responseText);
                                console.log(jqHXR);
                            });
  </code></pre>
  
  <p>The results are a global parseError: "This API does not support parsing form-encoded input.".   The first four steps are all using GET ajax calls, so I'm not sure if that is what is tripping me up.</p>
  
  <p>Here's the API in question: <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/insert" rel="nofollow">https://developers.google.com/google-apps/calendar/v3/reference/events/insert</a></p>
  
  <p>I think I may be doing things the long and hard way, and my new approach is to tackle this using the javascript API instead of going straight at it with manual JQuery and REST.  This is the approach I am attempting going forward <a href="http://code.google.com/p/google-api-javascript-client/wiki/Samples#Calendar_API" rel="nofollow">http://code.google.com/p/google-api-javascript-client/wiki/Samples#Calendar_API</a>, although I would still love to use this as a learning opportunity if there is something simple I am screwing up in the code above.</p>
  
  <p>Thanks for any help, insights, pointers, etc.  I will post updates if I make any progress using the javascript API.</p>