使用api从谷歌日历中删除事件

问题描述 投票:0回答:2

我正在尝试使用api从谷歌日历中删除事件:

$service->events->delete('primary', 'eventId');

我收到了这个错误:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "Not Found"
   }
  ],
  "code": 404,
  "message": "Not Found"
 }
}

我也尝试使用api explorer并发生同样的错误。

有人知道这是什么问题吗?

php api google-calendar-api google-api-php-client google-api-client
2个回答
1
投票

我使用python遇到了类似的问题。我做错的两件事:

  • 确保您的范围设置为'https://www.googleapis.com/auth/calendar'而不是'readonly'版本
  • 在python中,您需要在.execute()调用结束时添加delete()。我打赌在PHP中有类似的东西?

1
投票

从文档中复制一段代码时遇到了这个问题。然后我注意到该方法对日历ID一无所知。

$service->events->delete('calendarId', 'eventId');

也许这有帮助

© www.soinside.com 2019 - 2024. All rights reserved.