简体   繁体   English

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

[英]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. events.update更新要求填写所有字段。使用它的最佳方式是执行event.get更改您想要的字段然后发回。

Better option 更好的选择

Use events.patch instead if you just want to update a few fields. 如果您只想更新几个字段,请使用events.patch

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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