Returns events on the specified calendar.
This example returns the events for the calendar having the ID = "support@chilkatcloud.com"
#include <C_CkRestW.h>
#include <C_CkOAuth2W.h>
#include <C_CkStringBuilderW.h>
#include <C_CkJsonObjectW.h>
void ChilkatSample(void)
{
HCkRestW rest;
BOOL success;
HCkOAuth2W oauth2;
HCkStringBuilderW sbJson;
HCkJsonObjectW json;
const wchar_t *kind;
const wchar_t *etag;
const wchar_t *summary;
const wchar_t *updated;
const wchar_t *timeZone;
const wchar_t *accessRole;
const wchar_t *nextSyncToken;
int i;
int count_i;
const wchar_t *method;
int minutes;
const wchar_t *id;
const wchar_t *status;
const wchar_t *htmlLink;
const wchar_t *created;
const wchar_t *creatorEmail;
BOOL creatorSelf;
const wchar_t *organizerEmail;
BOOL organizerSelf;
const wchar_t *startDateTime;
const wchar_t *endDateTime;
const wchar_t *iCalUID;
int sequence;
const wchar_t *hangoutLink;
BOOL remindersUseDefault;
const wchar_t *location;
rest = CkRestW_Create();
// Provide a previously obtained OAuth2 access token.
oauth2 = CkOAuth2W_Create();
CkOAuth2W_putAccessToken(oauth2,L"OAUTH2_ACCESS_TOKEN");
CkRestW_SetAuthOAuth2(rest,oauth2);
success = CkRestW_Connect(rest,L"www.googleapis.com",443,TRUE,TRUE);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkOAuth2W_Dispose(oauth2);
return;
}
sbJson = CkStringBuilderW_Create();
success = CkRestW_FullRequestNoBodySb(rest,L"GET",L"/calendar/v3/calendars/support@chilkatcloud.com/events",sbJson);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkOAuth2W_Dispose(oauth2);
CkStringBuilderW_Dispose(sbJson);
return;
}
if (CkRestW_getResponseStatusCode(rest) != 200) {
wprintf(L"Received error response code: %d\n",CkRestW_getResponseStatusCode(rest));
wprintf(L"Response body:\n");
wprintf(L"%s\n",CkStringBuilderW_getAsString(sbJson));
CkRestW_Dispose(rest);
CkOAuth2W_Dispose(oauth2);
CkStringBuilderW_Dispose(sbJson);
return;
}
json = CkJsonObjectW_Create();
CkJsonObjectW_LoadSb(json,sbJson);
// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.
kind = CkJsonObjectW_stringOf(json,L"kind");
etag = CkJsonObjectW_stringOf(json,L"etag");
summary = CkJsonObjectW_stringOf(json,L"summary");
updated = CkJsonObjectW_stringOf(json,L"updated");
timeZone = CkJsonObjectW_stringOf(json,L"timeZone");
accessRole = CkJsonObjectW_stringOf(json,L"accessRole");
nextSyncToken = CkJsonObjectW_stringOf(json,L"nextSyncToken");
i = 0;
count_i = CkJsonObjectW_SizeOfArray(json,L"defaultReminders");
while (i < count_i) {
CkJsonObjectW_putI(json,i);
method = CkJsonObjectW_stringOf(json,L"defaultReminders[i].method");
minutes = CkJsonObjectW_IntOf(json,L"defaultReminders[i].minutes");
i = i + 1;
}
i = 0;
count_i = CkJsonObjectW_SizeOfArray(json,L"items");
while (i < count_i) {
CkJsonObjectW_putI(json,i);
kind = CkJsonObjectW_stringOf(json,L"items[i].kind");
etag = CkJsonObjectW_stringOf(json,L"items[i].etag");
id = CkJsonObjectW_stringOf(json,L"items[i].id");
status = CkJsonObjectW_stringOf(json,L"items[i].status");
htmlLink = CkJsonObjectW_stringOf(json,L"items[i].htmlLink");
created = CkJsonObjectW_stringOf(json,L"items[i].created");
updated = CkJsonObjectW_stringOf(json,L"items[i].updated");
summary = CkJsonObjectW_stringOf(json,L"items[i].summary");
creatorEmail = CkJsonObjectW_stringOf(json,L"items[i].creator.email");
creatorSelf = CkJsonObjectW_BoolOf(json,L"items[i].creator.self");
organizerEmail = CkJsonObjectW_stringOf(json,L"items[i].organizer.email");
organizerSelf = CkJsonObjectW_BoolOf(json,L"items[i].organizer.self");
startDateTime = CkJsonObjectW_stringOf(json,L"items[i].start.dateTime");
endDateTime = CkJsonObjectW_stringOf(json,L"items[i].end.dateTime");
iCalUID = CkJsonObjectW_stringOf(json,L"items[i].iCalUID");
sequence = CkJsonObjectW_IntOf(json,L"items[i].sequence");
hangoutLink = CkJsonObjectW_stringOf(json,L"items[i].hangoutLink");
remindersUseDefault = CkJsonObjectW_BoolOf(json,L"items[i].reminders.useDefault");
location = CkJsonObjectW_stringOf(json,L"items[i].location");
i = i + 1;
}
wprintf(L"Example Completed.\n");
CkRestW_Dispose(rest);
CkOAuth2W_Dispose(oauth2);
CkStringBuilderW_Dispose(sbJson);
CkJsonObjectW_Dispose(json);
}
{
"kind": "calendar#events",
"etag": "\"p32gd13choqmte0g\"",
"summary": "support@chilkatcloud.com",
"updated": "2017-11-07T22:49:27.892Z",
"timeZone": "America/Chicago",
"accessRole": "owner",
"defaultReminders": [
{
"method": "popup",
"minutes": 10
}
],
"nextSyncToken": "CKDQjZHGrdcCEKDQjZHGrdcCGAU=",
"items": [
{
"kind": "calendar#event",
"etag": "\"3004746854620000\"",
"id": "5jt9fopfg3rr9eftegiuq7gc5k",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NWp0OWZvcGZnM3JyOWVmdGVnaXVxN2djNWsgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-10T13:57:07.000Z",
"updated": "2017-08-10T13:57:07.310Z",
"summary": "Run 10 miles",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-10T12:00:00-05:00"
},
"end": {
"dateTime": "2017-08-10T13:00:00-05:00"
},
"iCalUID": "5jt9fopfg3rr9eftegiuq7gc5k@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.5jt9fopfg3rr9eftegiuq7gc5k",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004746898118000\"",
"id": "7dvh49vd219r3sq7jdueieu8rc",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=N2R2aDQ5dmQyMTlyM3NxN2pkdWVpZXU4cmMgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-10T13:57:29.000Z",
"updated": "2017-08-10T13:57:29.059Z",
"summary": "Eat Giordano's Pizza",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-10T15:00:00-05:00"
},
"end": {
"dateTime": "2017-08-10T16:00:00-05:00"
},
"iCalUID": "7dvh49vd219r3sq7jdueieu8rc@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.7dvh49vd219r3sq7jdueieu8rc",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004746915224000\"",
"id": "5btd89ljn07bg3tlgpimcaqrro",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NWJ0ZDg5bGpuMDdiZzN0bGdwaW1jYXFycm8gc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-10T13:57:37.000Z",
"updated": "2017-08-10T13:57:37.612Z",
"summary": "Nap",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-10T16:30:00-05:00"
},
"end": {
"dateTime": "2017-08-10T17:30:00-05:00"
},
"iCalUID": "5btd89ljn07bg3tlgpimcaqrro@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.5btd89ljn07bg3tlgpimcaqrro",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004915127736000\"",
"id": "703fss5qdedn1egq80ildhslba",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NzAzZnNzNXFkZWRuMWVncTgwaWxkaHNsYmEgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-11T13:19:23.000Z",
"updated": "2017-08-11T13:19:23.868Z",
"summary": "Run 12 miles",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-12T09:30:00-05:00"
},
"end": {
"dateTime": "2017-08-12T10:30:00-05:00"
},
"iCalUID": "703fss5qdedn1egq80ildhslba@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.703fss5qdedn1egq80ildhslba",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004915160212000\"",
"id": "02pv1cpdp7vm11htnfi3ii7iie",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MDJwdjFjcGRwN3ZtMTFodG5maTNpaTdpaWUgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-11T13:19:40.000Z",
"updated": "2017-08-11T13:19:40.106Z",
"summary": "Eat Lou Malnati's Pizza",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-12T12:00:00-05:00"
},
"end": {
"dateTime": "2017-08-12T13:00:00-05:00"
},
"iCalUID": "02pv1cpdp7vm11htnfi3ii7iie@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.02pv1cpdp7vm11htnfi3ii7iie",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004915175982000\"",
"id": "20l29s2idr5ggorncd3teahm0e",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MjBsMjlzMmlkcjVnZ29ybmNkM3RlYWhtMGUgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-11T13:19:47.000Z",
"updated": "2017-08-11T13:19:47.991Z",
"summary": "Nap",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-12T16:30:00-05:00"
},
"end": {
"dateTime": "2017-08-12T17:30:00-05:00"
},
"iCalUID": "20l29s2idr5ggorncd3teahm0e@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.20l29s2idr5ggorncd3teahm0e",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004969011208000\"",
"id": "v7kvmsvsoms3hjl5uq423jqhb0",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=djdrdm1zdnNvbXMzaGpsNXVxNDIzanFoYjAgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-11T20:48:25.000Z",
"updated": "2017-08-11T20:48:25.604Z",
"summary": "Eat Lou Malnati's Pizza",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-12T12:00:00-05:00"
},
"end": {
"dateTime": "2017-08-12T13:00:00-05:00"
},
"iCalUID": "v7kvmsvsoms3hjl5uq423jqhb0@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.v7kvmsvsoms3hjl5uq423jqhb0",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007268672000\"",
"id": "1p7fb5vob7vm57fepk4p1teft9",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MXA3ZmI1dm9iN3ZtNTdmZXBrNHAxdGVmdDkgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:27:14.000Z",
"updated": "2017-11-06T21:27:14.336Z",
"summary": "Breakfast at Tiffany's",
"location": "Tiffany's",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-06T07:00:00-06:00"
},
"end": {
"dateTime": "2017-11-06T08:00:00-06:00"
},
"iCalUID": "1p7fb5vob7vm57fepk4p1teft9@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.1p7fb5vob7vm57fepk4p1teft9",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007309018000\"",
"id": "05f5eieun35hoofbiab00ru03o",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MDVmNWVpZXVuMzVob29mYmlhYjAwcnUwM28gc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:27:34.000Z",
"updated": "2017-11-06T21:27:34.509Z",
"summary": "Lunch at Sushi House",
"location": "Sushi House",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-06T12:30:00-06:00"
},
"end": {
"dateTime": "2017-11-06T13:30:00-06:00"
},
"iCalUID": "05f5eieun35hoofbiab00ru03o@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.05f5eieun35hoofbiab00ru03o",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007516220000\"",
"id": "4hrv7chnc3jspepqr4ntrsq6k9",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NGhydjdjaG5jM2pzcGVwcXI0bnRyc3E2azkgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:29:17.000Z",
"updated": "2017-11-06T21:29:18.110Z",
"summary": "Dinner at Gia Mia",
"location": "Gia Mia",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-06T19:00:00-06:00"
},
"end": {
"dateTime": "2017-11-06T20:00:00-06:00"
},
"iCalUID": "4hrv7chnc3jspepqr4ntrsq6k9@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.4hrv7chnc3jspepqr4ntrsq6k9",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007580384000\"",
"id": "53k665tdurv5geejkl8d9eljmp",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NTNrNjY1dGR1cnY1Z2VlamtsOGQ5ZWxqbXAgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:29:50.000Z",
"updated": "2017-11-06T21:29:50.192Z",
"summary": "Breakfast at McDonald's",
"location": "McDonald's",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-09T07:00:00-06:00"
},
"end": {
"dateTime": "2017-11-09T08:00:00-06:00"
},
"iCalUID": "53k665tdurv5geejkl8d9eljmp@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.53k665tdurv5geejkl8d9eljmp",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007628078000\"",
"id": "27n9mbbabkur965n87ddir6m1i",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MjduOW1iYmFia3VyOTY1bjg3ZGRpcjZtMWkgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:30:14.000Z",
"updated": "2017-11-06T21:30:14.039Z",
"summary": "Lunch at McDonald's",
"location": "McDonald's",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-09T13:00:00-06:00"
},
"end": {
"dateTime": "2017-11-09T14:00:00-06:00"
},
"iCalUID": "27n9mbbabkur965n87ddir6m1i@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.27n9mbbabkur965n87ddir6m1i",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007645098000\"",
"id": "3jmu86tk17hc21gam5l073pu1k",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=M2ptdTg2dGsxN2hjMjFnYW01bDA3M3B1MWsgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:30:22.000Z",
"updated": "2017-11-06T21:30:22.549Z",
"summary": "Dinner at McDonald's",
"location": "McDonald's",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-09T19:00:00-06:00"
},
"end": {
"dateTime": "2017-11-09T20:00:00-06:00"
},
"iCalUID": "3jmu86tk17hc21gam5l073pu1k@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.3jmu86tk17hc21gam5l073pu1k",
"reminders": {
"useDefault": true
}
}
]
}