Javascript 谷歌日历。插入返回400';必需的';
我正试图通过GoogleJavaScriptAPI创建一个日历。OAuth身份验证工作正常:我可以通过以下方式获得日历列表:Javascript 谷歌日历。插入返回400';必需的';,javascript,google-calendar-api,Javascript,Google Calendar Api,我正试图通过GoogleJavaScriptAPI创建一个日历。OAuth身份验证工作正常:我可以通过以下方式获得日历列表: gapi.client.calendar.calendarList.list(); 但是,当我尝试使用以下内容创建日历时: gapi.client.calendar.calendars.insert( { "summary": "A New Calendar", "description": "Generated by Ben", "timezo
gapi.client.calendar.calendarList.list();
但是,当我尝试使用以下内容创建日历时:
gapi.client.calendar.calendars.insert(
{
"summary": "A New Calendar",
"description": "Generated by Ben",
"timezone" : "Australia/Sydney"
});
我得到:
{
"error": {
"code": 400,
"message": "Required",
"data": [
{
"domain": "global",
"reason": "required",
"message": "Required"
}
]
},
"id": "gapiRpc"
}
在中,它显示了此响应,但包含缺少的必需参数的列表
有没有办法确定我缺少什么“必需”参数?我已经用进行了测试,我的参数似乎工作正常。最终解决了这个问题。属性必须位于“资源”对象中:
gapi.client.calendar.calendars.insert(
{
"resource" :
{"summary": "A New Calendar",
"description": "Generated by Ben",
"timezone" : "Australia/Sydney"}
});
doco没有提到这一点,但是如果您查看对gapi.auth.authorize
的初始调用的响应,您会发现JSON描述了指定范围内的整个API