Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 谷歌日历API公众假期_Node.js_Google Api_Google Calendar Api - Fatal编程技术网

Node.js 谷歌日历API公众假期

Node.js 谷歌日历API公众假期,node.js,google-api,google-calendar-api,Node.js,Google Api,Google Calendar Api,我正在使用Node LiLibrary访问公共假日。我已经认证工作,并有权访问API。当我使用API explorer测试events.list端点时,我怀疑日历 calendarId:'en.sa#holiday@group.v.calendar.google.com" 存在于我的个人日历中,但不存在于应用程序日历中 calendar.events.list({ calendarId :'en.sa#holiday@group.v.calendar.google.com', auth: jwt

我正在使用Node LiLibrary访问公共假日。我已经认证工作,并有权访问API。当我使用API explorer测试events.list端点时,我怀疑日历

calendarId:'en.sa#holiday@group.v.calendar.google.com"

存在于我的个人日历中,但不存在于应用程序日历中

calendar.events.list({ calendarId :'en.sa#holiday@group.v.calendar.google.com', auth: jwtClient}, calenderGetComplete);
当我尝试在我的节点应用程序中获取日历列表时,列表为空:

calendar.calendarList.list({auth: jwtClient}, calenderGetComplete);
因此events.list找不到日历

calendar.events.list({ calendarId :'en.sa#holiday@group.v.calendar.google.com', auth: jwtClient}, calenderGetComplete);

所以,在个人日历上,你可以添加其他有趣的日历,比如公共假日日历,但你似乎无法为应用程序使用的日历添加这些日历?公共日历似乎没有“有趣的日历”?

我不确定您是如何验证Oauth2还是服务帐户的

日历列表和日历之间存在差异。日历列表只是谷歌日历网站左下角的一个小列表,它没有真正的用途(IMO)。如果你正在使用一个服务帐户,并授予它访问你个人(例如:chrisMalherbe at gmail.com)谷歌日历的权限,它将有权访问它,但它不会出现在服务帐户calendar.list中,除非你手动将其插入其中。当你将其中一个有趣的日历添加到你的个人谷歌日历页面(例如:gmail.com上的chrisMalherbe)时,网站会自动将其添加到calendar.list中

它真的不需要在那里

至于公共日历,每个人都可以访问,不需要在日历列表中。它们是公共的,您可以创建公共API密钥并从中请求数据。我不确定calendar en.sa是什么,但我会将您的API密钥转储到web浏览器中,以确保有数据。如果记忆有用的话,有一些是没有数据的,而且数据一年只持续一次,我想是的,如果你在2020年寻找假期,就不会有任何数据

GET https://www.googleapis.com/calendar/v3/calendars/en.sa#holiday@group.v.calendar.google.com/events?key=[APIKey]
或者如果不想使用公共API密钥,则使用访问令牌

GET https://www.googleapis.com/calendar/v3/calendars/en.sa#holiday@group.v.calendar.google.com/events?access_token=[accesstoken]
我不是node.js专家,但我发现这可能会有所帮助。我有一个关于这方面的教程,它主要解释了公共日历的工作原理,但是它在C#中可能对您有帮助,也可能没有帮助