Search code examples
javascriptgoogle-apigoogle-calendar-apigoogle-apps

Google calendar API update "Missing end time"


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?


Solution

  • 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