how can i get the event ID in the push notification response?

810 views
Skip to first unread message

Asaf Army

unread,
Nov 5, 2014, 2:29:45 AM11/5/14
to google-ca...@googlegroups.com
i set my application to watch a google calendar of mine.
when a new event is created in the calendar i get a notification into my application successfully.
The problen is that the POSt headers of the push notification message, does not include the eventID that was created in the calendar.
Is the push notification POST message that is send from the Google API to my application, supposed to have teh new eventID?
or the push notification only supposed to tell me "there was some change" but not give me the exact event ID of the event that changed?

the response POST Headers are these:

    [Content-Type] => application/json; charset=UTF-8
    [Accept] => */*
    [X-Goog-Channel-ID] => xxxxxxx-xxxxx-xxxx-ac19-b82e0ca32206
    [X-Goog-Channel-Expiration] => Fri, 05 Dec 2014 06:12:10 GMT
    [X-Goog-Resource-State] => exists
    [X-Goog-Message-Number] => 3711944
    [X-Goog-Resource-ID] => xxxxxxx-xxxxxx-pSbC27qOUfg
    [Content-Length] => 0
    [Connection] => Keep-alive
    [User-Agent] => APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)
    [Accept-Encoding] => gzip,deflate

i always get the same "X-Goog-Resource-ID" parameter value, no matter which evnt i created in teh calendar. why? 
isn't X-Goog-Resource-ID supposed to return the event ID?

the code for adding the watch for events is:


$client = new Google_Client();
$client->addScope("https://www.googleapis.com/auth/calendar");
$client->setAccessToken(mytoken);

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);




Matthew Zimmerman

unread,
Nov 5, 2014, 8:58:27 AM11/5/14
to google-ca...@googlegroups.com
On Wednesday, November 5, 2014 2:29:45 AM UTC-5, Asaf Army wrote:
or the push notification only supposed to tell me "there was some change" but not give me the exact event ID of the event that changed?

Asaf Army

unread,
Nov 5, 2014, 9:38:47 AM11/5/14
to google-ca...@googlegroups.com
ahh... that's dissapointing..
ok.. back to the "lab" to study syncToken :)

Thank you very much.
Reply all
Reply to author
Forward
0 new messages