Google 日历 API 更新 "Missing end time"

Google calendar API update "Missing end time"

我正在尝试使用以下方式更新活动:

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."
 }
}

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

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

events.update update requires that all of the fields be filled in. The best way to use it would be to do an event.get 更改您想要的字段然后 post 返回。

更好的选择

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

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