【问题标题】:Google Calendar REST API does not return title and other event fieldsGoogle Calendar REST API 不返回标题和其他事件字段
【发布时间】:2020-02-27 09:54:54
【问题描述】:

Google 日历 REST API GET 方法 (https://developers.google.com/calendar/v3/reference/events/get) 应返回此结构 (https://developers.google.com/calendar/v3/reference/events#resource),除非我遗漏了什么。

我需要获取要在我的应用程序中使用的事件标题和描述。相反,我得到了以下响应。

我已尝试更改活动可见性(公共/私人)和可用性(空闲/忙碌)。实际上,API 没有显示免费可用的事件,我也没有解决方案。

这是事件编辑屏幕截图: https://www.screencast.com/t/X8bRS8kJDT

{
   "kind":"calendar#event",
   "etag":"\"3145149995624000\"",
   "id":"5fnlvcl2msab46p8roqbahhb6g",
   "status":"confirmed",
   "htmlLink":"https://www.google.com/calendar/event?eid=NWZubHZjbDJtc2FiNDZwOHJvcWJhaGhiNmcgZWQtYWRtaW4uY29tXzMwOHNycjdzdjdiM28xazRpdjZ2cm9mb3Y0QGc",
   "updated":"2019-11-01T02:23:17.812Z",
   "start":{
      "dateTime":"2019-11-11T09:30:00+11:00"
   },
   "end":{
      "dateTime":"2019-11-11T10:00:00+11:00"
   },
   "visibility":"private",
   "iCalUID":"5fnlvcl2msab46p8roqbahhb6g@google.com"
}

是否有其他方法可以使用 REST API 获取日历事件详细信息,包括免费提供的方法?

谢谢。

2020 年 4 月 2 日: 我实际上使它适用于“普通”谷歌帐户 - 添加项目,添加 API,添加服务帐户并将服务帐户电子邮件分配到日历。但我仍然不确定如何更改 G Suite 帐户的访问级别。它只允许查看空闲/忙碌状态。

我已按照本文的建议更改了 Admin Console 中的默认访问权限,但这无济于事: https://www.macworld.com/article/2980005/the-mystery-of-the-unsharable-google-apps-calendar.html

【问题讨论】:

    标签: rest google-calendar-api


    【解决方案1】:

    您可以尝试指定要检索的字段,如下图所示:

    或者您可以将 " * " 如下图所示以检索所有值:

    fields 是标准查询参数,它指定您希望在响应中包含哪些值。想了解更多,可以查看Here

    【讨论】:

    • 我一直忙于其他项目,以便早点检查这个答案。我已经在上面尝试过,我可以在 Try this API 中看到字段,但对我的代码没有响应。我看到 Try this API 将“accessRole”作为“所有者”返回,但代码返回“freeBusyReader”。这可能是原因,但我不确定在哪里提供更多访问权限服务帐户对项目具有“所有者”角色,但我想应该是日历。
    猜你喜欢
    • 2013-12-04
    • 1970-01-01
    • 2019-07-16
    • 2014-06-18
    • 2016-07-18
    • 1970-01-01
    • 1970-01-01
    • 2020-08-07
    • 1970-01-01
    相关资源
    最近更新 更多