title: Inserting an event with the nodejs google calendar API returns 400: "Missing end time"
body: <p>I am trying to insert events via the Google Calendar API with a service account. The goal is to have one calendar that all users view: a server-to-server setup.</p>
  
  <p>As of now, I can properly call the calendar API and list the events on said calendar:</p>
  
  <pre><code>var moment = require("moment"),
      googleapis = require("googleapis"),
      googleCal = googleapis.calendar("v3");
      serviceEmail = "********@developer.gserviceaccount.com",
      serviceKeyFile = "./key.pem";
  
  var authClient = new googleapis.auth.JWT(
          serviceEmail,
          serviceKeyFile,
          null,
          ["https://www.googleapis.com/auth/calendar"]
      );
  
  authClient.authorize(function (err, tokens) {
      if (err) {
          console.log(err);
      } else {
          googleCal.events.list({
              auth: authClient,
              calendarId: "********@gmail.com",
              fields: {
                  items: ["end","start","summary"]
              }
          }, function (err, CL) {
              if (err) {
                  console.log(err);
              } else {
                  console.log(CL);
              }
          });
      }
  })
  </code></pre>
  
  <p>This properly returns a JSON object that lists all the different objects on the calendar. However, when I try to insert an event directly below the <code>googleCal.events.list</code> call:</p>
  
  <pre><code>googleCal.events.insert({
      auth: authClient,
      calendarId: "primary",
      resources: {
          start: {
            dateTime: "2014-07-23T18:25:00.000-07:00",
            timeZone: "America/New_York"
          }, 
          end: {
            dateTime: "2014-07-23T19:25:00.000-07:00",
            timeZone: "America/New_York"
          }, 
          summary: "winning @ life",
          description: "winning @ life description"
      }
  }, function (err, something) {
      if (err) {
          console.log(err);
      } else {
          console.log(something);
          // do something else
      }
  })
  </code></pre>
  
  <p>The following <code>400</code> is returned:</p>
  
  <pre><code>{ errors: 
      [ { domain: 'global',
          reason: 'required',
          message: 'Missing end time.' } ],
    code: 400,
    message: 'Missing end time.'}
  </code></pre>
  
  <p>How do I go about fixing this? The authorization is clearly working—I know because I've used up my unauthorized requests for the day and because I can list all the events. I have also specified an <code>endTime</code>. Why is the google calendar API telling me that I haven't?</p>