【问题标题】:Google Calendar API v3: FreeBusy request returning "The requested time range is too long."Google Calendar API v3:FreeBusy 请求返回“请求的时间范围太长”。
【发布时间】:2015-09-20 02:06:13
【问题描述】:

Google 日历的 freeBusy 方法似乎不会接受超过两个月左右的 timeMin/timeMax 范围。我应该如何找到从现在到永远(或未来的遥远点)日历范围内的忙/闲信息?

请求:

{
  "items": [
    {
      "id": "MY_GMAIL_CALENDAR_ID"
    }
  ],
  "timeMin": "2015-09-19T00:00:00-04:00", // today
  "timeMax": "2016-09-19T00:00:00-04:00" // 1 year from now
}

回复:

{
 "error": {
  "errors": [
   {
    "domain": "calendar",
    "reason": "timeRangeTooLong",
    "message": "The requested time range is too long.",
    "locationType": "parameter",
    "location": "timeMax"
   }
  ],
  "code": 400,
  "message": "The requested time range is too long."
 }
}

【问题讨论】:

  • 您可以针对加起来为“永远”的各个时间范围发送多个请求

标签: google-api google-calendar-api google-api-client google-client


【解决方案1】:

目前空闲忙碌查询的最大时间范围约为 3 个月,但该值可能会在没有警告的情况下更改。相反,如果您需要获取较长时间段内的忙/闲信息,最佳做法是使用合理的小范围(例如一个月)并执行多个查询。

【讨论】:

    猜你喜欢
    • 2013-09-05
    • 2021-11-22
    • 1970-01-01
    • 2022-08-19
    • 1970-01-01
    • 2021-05-01
    • 1970-01-01
    • 2021-12-12
    • 1970-01-01
    相关资源
    最近更新 更多