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/[email protected]/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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With