【发布时间】:2022-01-07 11:46:22
【问题描述】:
我正在尝试显示“公共”谷歌日历中的事件。我的要求是获取参加者的数量(不一定是参加者的姓名)。但是,当我使用日历 API(使用 API 密钥和 CalendarID)获取事件时;该活动缺少here 提到的整个与会者部分。
我的问题:我需要通过身份验证吗?这是否意味着这不能公开,显示此信息的网页需要“查看者”首先向 Google 进行身份验证?
这是我的代码的 sn-p(已编辑)...
$.ajax({
type: 'GET',
url: encodeURI('https://www.googleapis.com/calendar/v3/calendars/' + calendarId+ '/events?key=' + myKey),
dataType: 'json',
success: function (response) {
console.log(response);
//here is where I need to get the number of participants
},
error: function (error) {
console.log(error);
//tell that an error has occurred
}
这是输出...
{种类:'calendar#events',etag:'"p324e9j5nqabva0g"',摘要:'EDWC Schedule',描述:'',更新:'2022-01-04T08:09:10.933Z',...} accessRole: '读者' 默认提醒:(0) [] 描述: '' 电子标签:'""' 项目:(2) [{…}, {…}] 0: {kind: 'calendar#event', etag: '""', id: '', status: 'confirmed', htmlLink:…} 1: {kind: 'calendar#event', etag: '""', id: '', status: 'confirmed', htmlLink:…} 会议数据:{} 创建:'' 创建者:{} 描述: '' 结束:{日期时间:'2022-01-08T16:00:00+11:00',时区:'澳大利亚/悉尼'} 电子标签:'' 事件类型:'默认' 环聊链接:'' html链接:'' iCalUID:'' ID: '' 种类:'日历#事件' 地点:“澳大利亚” 组织者:{电子邮件:'',显示名称:'',自我:真} 序列:0 开始:{日期时间:'2022-01-08T13:00:00+11:00',时区:'澳大利亚/悉尼'} 状态:“确认” 概括: '' 更新:'2022-01-04T08:09:10.933Z' [[原型]]:对象 [[原型]]:对象 长度:2 [[原型]]:数组(0) 种类:'日历#事件' nextSyncToken: 'CIjkzLfSl_UCEAAYASCvg6XIAQ==' 概括: '' 时区:'澳大利亚/墨尔本' 更新:'2022-01-04T08:09:10.933Z' [[原型]]:对象
【问题讨论】:
标签: javascript google-calendar-api