Reputation: 15
Hey I'm using an API for first time, and I am confused about how to get event ID from Calendar API. Currently I'm using the sample quickstart.php file, and getting summary from this:
$results = $service->events->listEvents($calendarId, $optParams);
$events = $results->getItems();
if (empty($events)) {
print "No upcoming events found.\n";
} else {
print "Upcoming events:\n";
foreach ($events as $event) {
$start = $event->start->dateTime;
if (empty($start)) {
$start = $event->start->date;
}
printf("%s (%s)\n", $event->getSummary(), $start);
}
}
Thanks in advance.
Upvotes: 1
Views: 891
Reputation: 61
This is so simple as mention above you can fetch id by $event->ID
or you can use
print_r($events)
to see the data.
Upvotes: 1
Reputation: 608
It's written in the CalendarList Resource representation of the documentation. id
is part of the calendarList Resource
object within the array of items
. Within the foreach of $events
$event->id;
Upvotes: 2