Google calendar API update “Missing end time”

瘦欲@ 提交于 2019-12-23 15:45:02

问题


I'm trying to update an event using:

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

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

but get a response:

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

Why do I need a end time if I just need to update a summary or other fields?


回答1:


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

is 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 change the fields you want then post that back.

Better option

Use events.patch instead if you just want to update a few fields.

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


来源:https://stackoverflow.com/questions/31555019/google-calendar-api-update-missing-end-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!