缺少结束时间Google日历

时间:2014-07-28 07:35:02

标签: javascript json google-api google-calendar-api

这是我的Google日历请求。在响应中,错误代码是"缺少结束时间。"我试图让这个动态化,所以我最终会删除硬编码的开始和结束日期时间。

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);

3 个答案:

答案 0 :(得分:3)

这家伙有答案

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);

答案 1 :(得分:0)

可能,这个错误的原因没有错误的时间。也许,Calendar API无法识别您的json。 http请求的标头必须包含" Content-Type:application / json"。见http://devsplanet.com/question/37535563

答案 2 :(得分:0)

这对我有用:

handleChange()
相关问题