Deletes an entry on the user's calendar list. (i.e. Deletes a calendar.)
This example deletes the calendar having the calenderId = "chilkatcloud.com_he3bfm0ljrl7p427u8vjmg9afo@group.calendar.google.com". The calendar ID's can be obtained by listing the calendars.
A response status code equal to 204 indicates success (with no response body).
#include <C_CkRest.h>
#include <C_CkOAuth2.h>
#include <C_CkStringBuilder.h>
void ChilkatSample(void)
{
HCkRest rest;
BOOL success;
HCkOAuth2 oauth2;
HCkStringBuilder sbResponse;
rest = CkRest_Create();
// Provide a previously obtained OAuth2 access token.
oauth2 = CkOAuth2_Create();
CkOAuth2_putAccessToken(oauth2,"OAUTH2_ACCESS_TOKEN");
CkRest_SetAuthOAuth2(rest,oauth2);
success = CkRest_Connect(rest,"www.googleapis.com",443,TRUE,TRUE);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkOAuth2_Dispose(oauth2);
return;
}
sbResponse = CkStringBuilder_Create();
success = CkRest_FullRequestNoBodySb(rest,"DELETE","/calendar/v3/users/me/calendarList/chilkatcloud.com_he3bfm0ljrl7p427u8vjmg9afo@group.calendar.google.com",sbResponse);
if (success != TRUE) {
printf("%s\n",CkRest_lastErrorText(rest));
CkRest_Dispose(rest);
CkOAuth2_Dispose(oauth2);
CkStringBuilder_Dispose(sbResponse);
return;
}
if (CkRest_getResponseStatusCode(rest) != 204) {
printf("Received error response code: %d\n",CkRest_getResponseStatusCode(rest));
printf("Response body:\n");
printf("%s\n",CkStringBuilder_getAsString(sbResponse));
CkRest_Dispose(rest);
CkOAuth2_Dispose(oauth2);
CkStringBuilder_Dispose(sbResponse);
return;
}
printf("Example Completed.\n");
CkRest_Dispose(rest);
CkOAuth2_Dispose(oauth2);
CkStringBuilder_Dispose(sbResponse);
}