简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM