theB3RV
theB3RV

Reputation: 924

Missing End Time Google Calendar

Here is my google calendar request. In the response, the error code is "Missing End Time." I'm trying to make this dynamic, so I will end up removing the hard coded start and end dateTimes.

var object = {
        "end": {
            'dateTime': "2014-07-28T23:00:00",//end,
            "timeZone": timeZone
        },
        "start": {
            'dateTime': "2014-07-28T18:00:00",//start,
            "timeZone": timeZone
        },
        "calendarId": calendarId,
        "summary": artist,
        "description": description,
        "location": address
    };
    var request = gapi.client.calendar.events.insert(object);

Upvotes: 11

Views: 8849

Answers (3)

Hatem
Hatem

Reputation: 323

This worked for me:

var event = {
      summary: "Google I/O 2015",
      location: "800 Howard St., San Francisco, CA 94103",
      description: "A chance to hear more about Google's developer products.",
      start: {
        date: "2020-05-28"
      },
      end: {
        date: "2020-05-29"
      }
    };

    gapi.client.calendar.events
      .insert({
        calendarId: calendarId,
        resource: event
      })

Upvotes: 0

segreb
segreb

Reputation: 31

Probably, the reason of this error not wrong time. Probably, Calendar API can't recognize you json. Header of http-request MUST contain "Content-Type: application/json". See here http://devsplanet.com/question/37535563

Upvotes: 1

theB3RV
theB3RV

Reputation: 924

This guy had the answer

https://groups.google.com/forum/#!msg/google-calendar-api/cnkgXfy_GQQ/SRV1N0TAGtYJ

    var object = {
        'end': {
            'dateTime': '2014-07-28T23:00:00',//end,
            'timeZone': timeZone
        },
        'start': {
            'dateTime': '2014-07-28T18:00:00',//start,
            'timeZone': timeZone
        }
        //'summary': artist,
        //'description': description,
        //'location': address
    };
    var calendarObject =
    {
        'calendarId': calendarId,
        'resource': object
    };
    var request = gapi.client.calendar.events.insert(calendarObject);

Upvotes: 6

Related Questions