我正在一个项目中,我需要咨询与会者的答复。我想创建一个脚本,每隔几个小时检查一次是否有与会者更改了您的响应状态,但是我找不到任何文档来说明工作原理,这是插入事件时我的代码示例:
if (isset($_SESSION['access_token'])) {
$client->setAccessToken($_SESSION['access_token']);
$service = new Google_Service_Calendar($client);
$event = new Google_Service_Calendar_Event(array(
'summary' => $summary,
'location' => $location,
'description' => $descripcion,
'colorId'=> "5",
'start' => array(
'dateTime' => $datetimeini,
'timeZone' => 'America/Caracas'
),
'end' => array(
'dateTime' => $datetimeini,
'timeZone' => 'America/Caracas'
),
'recurrence' => array(
'RRULE:FREQ=DAILY;COUNT=1'
),
'attendees' => array(
array('email' => $paciente,'responseStatus'=> 'needsAction'),
array('email' => $doctor)
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 12 * 60),
array('method' => 'popup', 'minutes' => 60)
),
),
));
$new_event = null;
$new_event_id = "";
$new_event = $service->events->insert($idcalendar, $event);
if($new_event!=null){
$new_event_id= $new_event->getid();
$event = $service->events->get($idcalendar,$new_event_id);
$response = new Google_Service_Calendar_EventAttendee($client);
if($event != null){
$resultado=array(
"respuesta"=>"exitoso",
"id evento"=>$event->getid(),
"sumario"=>$event->getSummary(),
"estado"=>$event->getstatus(),
"response"=>$event->getresponseStatus()
);
}else{
echo 'hay problemas.';
}
如果我在响应中尝试此代码,我只会得到null
。我想得到真正的答复。
答案 0 :(得分:0)
您可以使用Events: watch
方法来监视事件资源的更改。
HTTP请求
POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch
在请求正文中,提供具有以下结构的数据:
{ "id": string, "token": string, "type": string, "address": string, "params": { "ttl": string } }