【问题标题】:Embedded Google Calendar API嵌入式谷歌日历 API
【发布时间】:2015-12-25 07:31:38
【问题描述】:
o/
长话短说,我正在 .NET 中为 Google Calendar API 开发一个项目。我遇到的问题我希望能够从公开可用的日历文档中检索信息,但是它是嵌入的,并且我没有它的 ID,所以我无法通过 API 连接到它。有谁知道我如何通过 API 主动检索数据或获取 ID 以便我可以正常连接?
我是 API 领域的新手,但已经完成了一些 JSON 解析并使用 Google Sheets API,所以请保持简单:P
谢谢大家,节日快乐...为什么我要在 API 圣诞节工作 -.-
【问题讨论】:
标签:
vb.net
api
google-api
google-calendar-api
google-api-dotnet-client
【解决方案1】:
要通过 chrome 获取嵌入式日历的 id,您可以检查页面,找到 iframe 元素并获取 src 属性。
在下面的示例中,src 的值为“en.usa%23holiday%40group.v.calendar.google.com”。解码后的值为“en.usa#holiday@group.v.calendar.google.com”
<iframe src="https://www.google.com/calendar/embed?src=en.usa%23holiday%40group.v.calendar.google.com" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"> </iframe>
以下是使用calendar api explorer 获取日历ID 的日历详细信息的示例调用。 (您可以点击链接探索其他 API)
GET https://www.googleapis.com/calendar/v3/calendars/en.usa%23holiday%40group.v.calendar.google.com?fields=description%2Cetag%2Cid%2Ckind%2Clocation%2Csummary&key={YOUR_API_KEY}
回应:
{
"kind": "calendar#calendar",
"etag": "\"wPB4sv3SXX_TNjlIyBWrKwcZTHg/nUiLfyW1Tclq4NFare2eNmH24do\"",
"id": "en.usa#holiday@group.v.calendar.google.com",
"summary": "Holidays in United States",
"description": "Holidays and Observances in United States"
}