简体   繁体   English

PHP 谷歌插入日历事件 API

[英]PHP Google insert calendar event API

I am using this package: https://github.com/googleapis/google-api-php-client我正在使用这个 package: https://github.com/googleapis/google-api-php-client

$google_service = new Google_Service_Calendar($google_client);
$event = new Google_Service_Calendar_Event(array(....));
// Insert Calendar event
$event = $google_service->events->insert($calendarId, $event);
p($event);
$meet_link = $event->conferenceData->entryPoints[0]->uri;

I used to get $meet_link like this from the API but suddenly it started throwing error我曾经像这样从 API 获取$meet_link但突然它开始抛出错误

trying to get property 'entryPoints' of non-object"

Infact calendar event has been inserted perfectly but I am not getting $event->conferenceData->entryPoints[0]->uri in response.事实上日历事件已完美插入,但我没有得到$event->conferenceData->entryPoints[0]->uri作为响应。 Infact I am not getting this entryPoints object($event->conferenceData->entryPoints)事实上,我没有得到这个 entryPoints object($event->conferenceData->entryPoints)

There seems to be an issue with the conferenceData returned when creating an event with the API.使用 API 创建事件时返回的会议数据似乎有问题

You can click on the star next to the issue number to receive updates and to give more priority to the report.您可以单击问题编号旁边的星号以接收更新并给予报告更高的优先级。

Finally found the solution.终于找到了解决办法。 Request part needs to change.请求部分需要更改。

For the PHP API对于 PHP API

I passed conference Data in request我在请求中传递了会议数据

$event = [ 
    .......,
    "conferenceData" => [
            "createRequest" => [
                 "conferenceSolutionKey" => [
                    "type" => "hangoutsMeet"
                 ],
                "requestId" => "123"
            ]
    ]
];
$google_service->events->insert($calendarId, $event,['conferenceDataVersion' => 1]);    

and passed 3rd parameter as settings ['conferenceDataVersion' => 1] Then its returning meeting link so its working now.并将第三个参数作为设置 ['conferenceDataVersion' => 1] 传递,然后返回会议链接,因此它现在可以正常工作。

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

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