[英]Missing End Time Google Calendar
这是我的谷歌日历请求。 在响应中,错误代码是“缺少结束时间”。 我正在尝试使其动态化,因此我最终将删除硬编码的开始和结束日期时间。
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);
这个人给出了答案
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);
可能,这个错误的原因不是错误的时间。 可能,日历 API 无法识别您的 json。 http-request 的头部必须包含“Content-Type: application/json”。 见这里http://devsplanet.com/question/37535563
这对我有用:
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
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.