如何从Google日历获取活动详细信息 [英] how to get event details from google calendar

查看:255
本文介绍了如何从Google日历获取活动详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在日历中创建新活动时,我已成功地从Google日历向我的系统发送推送通知。
推送通知在POST正文中没有数据,POST标题是这些:

  [Host] => ; xxxxxx.xxxx.com 
[Content-Type] => application / json; charset = UTF-8
[Accept] => * / *
[X-Goog-Channel-ID] => xxxxxxx-xxxxxxxx-8824-f0c2166878be
[X-Goog-Channel-Expiration] => Thu,04 Dec 2014 04:27:13 GMT
[X-Goog-Resource-State] => exists
[X-Goog-Message-Number] => 11897215
[X-Goog-Resource-ID] => xxxxxxxxxx-xxxx-pSbC27qOUfg
[X-Goog-Resource-URI] => https://www.googleapis.com/calendar/v3/calendars/xxxxxxx@gmail.com/events?key=AIzaSyC_0nytiZWHfabrpWiExxxxxxxxxxx&alt=json
[Content-Length] => 0
[Connection] => Keep-alive
[Accept-Encoding] => gzip,deflate
[User-Agent] => APIs-Google; (+ https://developers.google.com/webmasters/APIs-Google.html)

其中是在日历中创建的新活动详细信息?
我如何获得他们?



没有在线信息,没有在google文档中的信息(已搜索小时):
https://developers.google.com/google-apps/calendar/v3/push



活动详情在哪里



UPDATE: b
$ b

我使用此代码在我的日历上设置了一个手表:

  service = new Google_Service_Calendar $ client); 
$ channel = new Google_Service_Calendar_Channel($ client);
$ uuid = gen_uuid();
$ channel-> setId($ uuid);
$ channel-> setType('web_hook');
$ channel-> setExpiration('1919995862000');

global $ sugar_config;
$ address = $ sugar_config ['site_url']。 /index.php?entryPoint=updateFromCal;
$ channel-> setAddress($ address);
$ watchEvent = $ service-> events-> watch($ bean-> google_cal_id_c,$ channel);

这是我发送给google日历api的频道详情:

  [address] => https://mydomainXXXX/index.php?entryPoint = updateFromCal 
[expiration] => 1919995862000
[id] => xxxxxxxxxxxxxxx - 4558-ac19-b82e0ca32206
[kind] =>
[params] =>
[payload] =>
[resourceId] =>
[resourceUri] =>
[token] =>
[type] => web_hook
[modelData:protected] =>数组



[processed:protected] =>数组




我仍​​然在响应中获得相同的资源ID ,每一个新的事件我创建在日历!为什么我不能得到刚创建的事件的事件ID?我做错了什么?我在看活动或频道?



我得到的答复仍然是上面提到的,它与所有的时间相同的资源id。

解决方案

推送不包含任何数据。它只告诉你那个资源中有什么变化。你需要做一个列表请求,找出它是什么。优选地,该列表请求将是增量同步。在此处查看如何进行同步: https://developers.google.com/google-apps/ calendar / v3 / sync


i succeeded in getting a push notification from google calendar into my system, when a new event is created in the calendar. the push notification has no data in the POST body and the POST headers are these:

[Host] => xxxxxx.xxxx.com
[Content-Type] => application/json; charset=UTF-8
[Accept] => */*
[X-Goog-Channel-ID] => xxxxxxx-xxxxxxxx-8824-f0c2166878be
[X-Goog-Channel-Expiration] => Thu, 04 Dec 2014 04:27:13 GMT
[X-Goog-Resource-State] => exists
[X-Goog-Message-Number] => 11897215
[X-Goog-Resource-ID] => xxxxxxxxxx-xxxx-pSbC27qOUfg
[X-Goog-Resource-URI] => https://www.googleapis.com/calendar/v3/calendars/xxxxxxx@gmail.com/events?key=AIzaSyC_0nytiZWHfabrpWiExxxxxxxxxxx&alt=json
[Content-Length] => 0
[Connection] => Keep-alive
[Accept-Encoding] => gzip,deflate
[User-Agent] => APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)

where are the new event details that was created in the calendar? how do i get them?

no information online and no information in google documentation (been searching for hours): https://developers.google.com/google-apps/calendar/v3/push

where are the event details??

UPDATE:

i set a watch on my calendar using this code:

service = new Google_Service_Calendar($client);         
$channel =  new Google_Service_Calendar_Channel($client);
$uuid = gen_uuid();
$channel->setId($uuid);
$channel->setType('web_hook');
$channel->setExpiration('1919995862000');

global $sugar_config;
$address = $sugar_config['site_url'] . "/index.php?entryPoint=updateFromCal";
$channel->setAddress($address);
$watchEvent = $service->events->watch($bean->google_cal_id_c, $channel);

This is the channel details i send to google calendar api:

[address] => https://mydomainXXXX/index.php?entryPoint=updateFromCal
[expiration] => 1919995862000
[id] => xxxxxxxxxxxxxxx--4558-ac19-b82e0ca32206
[kind] => 
[params] => 
[payload] => 
[resourceId] => 
[resourceUri] => 
[token] => 
[type] => web_hook
[modelData:protected] => Array
    (
    )

[processed:protected] => Array
    (
    )

i still get the same resource ID in the response, with every new event i create in the calendar! why can't i get the event ID of the event i just created? what did i do wrong? am i watching events or channels?

the reply i get is still the one mentioned above, its with the same resource id all the time.

解决方案

The push does not contain any data. It only tells you that something changed in that resource. You will need to do a list request to find out what it was. Preferably this list request will be an incremental sync. Take a look into how to do synchronization here: https://developers.google.com/google-apps/calendar/v3/sync

这篇关于如何从Google日历获取活动详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆