PHP Extension Google Calendar: Delete an Event

Back to Index

Deletes an event from a calendar.
This example deletes an event from the calendar having the ID = "". The event ID to be deleted is "1p7fb5vob7vm57fepk4p1teft9".
If successful, the response is empty and the response status code = 204.



// The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number.
// For example, if using Chilkat v9.5.0.48, then include as shown here:

$rest = new CkRest();

//   Provide a previously obtained OAuth2 access token.
$oauth2 = new CkOAuth2();

$success = $rest->Connect('',443,true,true);
if ($success != true) {
    print $rest->lastErrorText() . "\n";

$sbResponse = new CkStringBuilder();
$success = $rest->FullRequestNoBodySb('DELETE','/calendar/v3/calendars/',$sbResponse);
if ($success != true) {
    print $rest->lastErrorText() . "\n";

if ($rest->get_ResponseStatusCode() != 204) {
    print 'Received error response code: ' . $rest->get_ResponseStatusCode() . "\n";
    print 'Response body:' . "\n";
    print $sbResponse->getAsString() . "\n";

print 'Example Completed.' . "\n";