Google美国假期日历Feed禁止 [英] Google US Holidays Calendar Feed Forbidden

查看:172
本文介绍了Google美国假期日历Feed禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此Google日历Feed,我正在拉动美国假期...



https://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public /全ALT = JSON-在脚本和放大器;回调= jQuery18204341156887821853_1416248123466和放大器;启动分钟= 2014-10-26T00%3A00%3A00Z和放大器;启动最大= 2014-12-07T00%3A00%3A00Z和放大器; singleevents =真放;最大结果= 9999& _ = 1416248372436



现在它返回禁止错误403.我假设这与v2今天正在关闭有关: https://developers.google.com/google-apps/calendar/v2/develope rs_guide_protocol



我无法找到如何使用v3获取此提要。有人知道吗?



更新:看起来我没有使用上面的网址,我实际上使用这个网址: https://www.google.com/calendar/feeds/usa__en% 40holiday.calendar.google.com/public/basic



它似乎有效。该错误似乎与我使用的 fullcalendar jQuery插件有关。这是采取这个网址的作品,并把它变成我发布的最初一个不起作用。我会进一步调查,看fullcalendar是否有补丁或新版本。

解决方案

今天我经历了同样的问题。客户端一直在使用fullcalendar。问题似乎在于Google关闭了API(v1,v2)

http://googleappsupdates.blogspot.ca/2014/06/calendar-gdata-api-google-calendar.html



我一直致力于使其与v3兼容。我上传了您可能需要的文件:

http://dev.radicalwerks.com/RadicalCalendar/rwCal/fullcalendar.js





http://dev.radicalwerks.com/RadicalCalendar/rwCal/gcal。 js



在这里你可以看到这个例子的工作:





为了启用API并使其工作,您需要执行几个步骤。

首先创建一个客户端ID并从Google的开发者控制台获取一个密钥:

https://console.developers.google.com/project



为了做到这一点,创建项目,转到APIs&身份验证等。获取客户端ID时,请将授权的重定向URIS textarea保留为空。添加您需要在JAVASCRIPT ORIGINS下运行API的域(您可以使用多个域,每行添加一个域)。您可能知道所有这些,但可以帮助那些对其工作原理没有清楚概念的人。



获得客户端ID和密钥后,您必须添加他们到位于fullcalendar.js文件中的变量。它们位于顶部:

  var clientId 

var apiKey

保留范围值。最后,您需要获取日历ID(位于日历设置/日历详情/日历地址下的XML徽章旁边),您必须将其添加到我们通常用于添加网址的对象中。您需要添加一个名为calendarId的新属性,如果您查看 http://dev.radicalwerks.com/RadicalCalendar/my_fgcalendar.html 你可以看到我是如何加入我的。



你需要加载的最后一件事通过在头上添加API:

 < script src =https://apis.google.com/js/ client.js>< / script> 

之间的意见: / *由Yared新的更新* /



我必须改善代码,它只是一个快速修复,使其工作。现在是时候睡觉了:)我可能很快更新代码。基本上,所以你知道,如果检测到属性CalendarID,然后我使用API​​ v3发出请求并根据新格式调整事件对象,我中断了AJAX调用。



我想我不会错过任何东西。我希望所有这些都有所帮助。

I was pulling in US holidays using this google calendar feed...

https://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/full?alt=json-in-script&callback=jQuery18204341156887821853_1416248123466&start-min=2014-10-26T00%3A00%3A00Z&start-max=2014-12-07T00%3A00%3A00Z&singleevents=true&max-results=9999&_=1416248372436

It now returns Forbidden Error 403. I'm assuming this has to do with v2 being shutdown today: https://developers.google.com/google-apps/calendar/v2/developers_guide_protocol

I can't find how to get this feed with v3. Does anyone know?

UPDATE: It appears I am not using the URL above, I am actually using this URL: https://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic

And it appears to work. The bug seems to be with the "fullcalendar" jQuery plugin I am using. It is taking this URL that works and turning it into the initial one I posted that does not work. I will investigate further and see if the fullcalendar has a patch or new version.

解决方案

I went through the same problem today.My client has been using fullcalendar for a while now. The problem seems to be that Google shut down the API (v1, v2)

http://googleappsupdates.blogspot.ca/2014/06/calendar-gdata-api-google-calendar.html

I have been working on making it compatible with the v3. I uploaded the files you may need here:

http://dev.radicalwerks.com/RadicalCalendar/rwCal/fullcalendar.js

and

http://dev.radicalwerks.com/RadicalCalendar/rwCal/gcal.js

Here you can see the example working:

http://dev.radicalwerks.com/RadicalCalendar/my_fgcalendar.html

There is a few steps you need to do in order to enable the API and make it work.

First of all create a client ID and get a Key from the developer console of google:

https://console.developers.google.com/project

In order to do that, create project, go to credentials under APIs & Auth etc. When you get the client ID, keep the AUTHORIZED REDIRECT URIS textarea blank. Add the domain where you need to run the API under JAVASCRIPT ORIGINS (you can use several domains adding one per line). You might know all of this but could help to others who does not have a clear idea of how it works.

Once you get the client ID and Key you have to add them into the variables located in the fullcalendar.js file. They are on top:

var clientId

var apiKey

Keep the scope value. Finally you need to get the calendar ID (located beside the XML badge under calendar settings / Calendar Details / Calendar Address. You have to add it in the object we usually use to add the url. You will not need the url anymore. You need to add a new property called "calendarId". If you check the live example under http://dev.radicalwerks.com/RadicalCalendar/my_fgcalendar.html you can see how I added mine.

One last thing you need to load the API by adding on the head:

<script src="https://apis.google.com/js/client.js"></script>    

All the additions I did in those 2 files are between comments: /* New update by Yared */

I have to improve the code, it is just a quick fix to make it work. Now it is time to sleep :) I will probably update the code soon. Basically, so you know, I interrupted the AJAX call if is detecting the property CalendarID and then I am making a request using the API v3 and adjusting the events object according to the new format.

I think I am not missing anything. I hope all of this helps.

这篇关于Google美国假期日历Feed禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆