当前位置: 首页 > 知识库问答 >
问题:

Google日历事件API抛出错误

萧晔
2023-03-14

我使用OAuth对我的应用程序进行了身份验证,并使用日历API对其进行了测试。一切正常。我还为事件API使用了“快速添加”方法,效果很好。但是当我尝试使用以下代码插入时

$event = new Event();
$event->setSummary('hello there');
$event->setLocation('America/Los_Angeles');
$start = new EventDateTime();
$start->setDateTime('2012-04-19');
$event->setStart($start);
$createdEvent = $cal->events->insert('myemail@gmail.com', $event);

我得到以下错误:

致命错误:未捕获异常“apiServiceException”,消息为“调用POST时出错
https://www.googleapis.com/calendar/v3/calendars/myemail@gmail。com/事件?key=AIzaSyBddYIgnZJrXHuT8gvX-0tEypxsycw99rA:(400)C:\xampp\htdocs\uis\google api php client\src\io\apiREST中的“错误请求”。php:86堆栈跟踪:#0 C:\xampp\htdocs\uis\google-api-php-client\src\io\apiREST。php(56):apiREST::decodeHttpResponse(对象(apiHttpRequest))\1 C:\xampp\htdocs\uis\google api php客户端\src\service\apiServiceResource。php(187):apiREST::execute(Object(apiServiceRequest))#2 C:\xampp\htdocs\uis\google api php client\src\contrib\apiCalendarService。php(493):apiServiceResource-

myemail@gmail.com是我日历的ID。它适用于其他一切。

我做错了什么?

共有1个答案

宰宣
2023-03-14

您似乎没有设置活动的与会者。

示例:

$end = new EventDateTime();
$end->setDateTime('2011-06-03T10:25:00.000-07:00');
$event->end = $end;

$attendee1 = new EventAttendee();
$attendee1->email = 'attendeeEmail';

$attendees = array($attendee1, ...);
$event->attendees = $attendees;
 类似资料:
  • 我试图使用delphi REST控件将一个事件插入到我的google日历中。 这是迄今为止的代码: 我使用的范围是:https://www.googleapis.com/auth/calendar. 基本URL:https://www.googleapis.com/calendar/v3 资源URI:日历/主要/事件 我确实获得了访问令牌和刷新令牌,但无法发布请求。这是我收到的错误: 使用以下ur

  • 我正在扩展一个PHP应用程序,它允许管理员创建事件并为这些事件分配特定用户。但是,在用户被列为可分配之前,我会检查用户的日历,看看他们是否可用。 我已经使用EWS为Exchange构建了一次,并使用FindItem方法在给定的时间段内检索用户电子邮件地址的事件,但我在Google日历API中很难找到等效的事件。 Events和FreeBusy Call似乎都需要特定用户的calendarId,这对

  • 我从快速入门开始(https://developers.google.com/google-apps/calendar/quickstart/python)而且效果很好。然后我尝试用这个指南插入事件(https://developers.google.com/google-apps/calendar/create-events)。我将此代码添加到quickstart的代码中,但出现错误。如何查看我

  • 我正在开发一个用PHP和javascript编写的web应用程序。在这个应用程序中,我们将一些事件存储在自己的数据库中。 现在,我们要做的是,每当我们在应用程序中创建一个新事件时,它都应该在当前登录用户的谷歌日历的谷歌日历上创建一个重复的事件。 我们可以要求我们的用户从他们的谷歌控制台生成一个API密钥。 有没有办法创建一个谷歌日历事件通过使用一个API密钥,而没有任何其他配置。 谢谢

  • 我是Google日历API和PHP的新手,我似乎不知道如何实现我想做的事情。基本上,我想从calendarID为的google日历中检索事件webapps098@gmail.com.我当前的代码是这样的 我收到错误: 异常Google_ServiceException消息错误调用GEThttps://www.googleapis.com/calendar/v3/calendars/webapps0

  • 最近,在Google日历中添加了新事件并尝试从Google日历API中获取后,我从未获得我帐户主日历的新事件列表。 此外,我还尝试从开发人员控制台获取:https://developers.google.com/google-apps/calendar/v3/reference/events/list#try-it 它给出了相同的空项目列表作为响应,即使未来的事件存在。 但是我能够获取其他日历列表