Google日历API更新“缺少结束时间”

时间:2015-07-22 06:01:30

标签: javascript google-api google-calendar-api google-apps

我正在尝试使用以下内容更新活动:

PUT https://www.googleapis.com/calendar/v3/calendars/primary/events/q4es0o2o70naq8idj1dj6q4354

{
 "reminders" {"useDefault":true},
 "summary":"updatedsummary",
 "description":"updated desc"
}

但得到回复:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Missing end time."
   }
  ],
  "code": 400,
  "message": "Missing end time."
 }
}

如果我只需要更新摘要或其他字段,为什么需要结束时间?

1 个答案:

答案 0 :(得分:4)

PUT https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId

events.update更新要求填写所有字段。使用它的最佳方式是event.get更改您想要的字段,然后将其发回。

更好的选择

如果您只想更新几个字段,请使用events.patch

PATCH https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId