Returns instances of the specified recurring event.
This example gets instances for an event from the calendar having the ID = "support@chilkatcloud.com", where the event ID equals "6li3bfqqq65edprt4ms6vdld2j"
#include <CkRestW.h>
#include <CkOAuth2W.h>
#include <CkStringBuilderW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
CkRestW rest;
bool success;
// Provide a previously obtained OAuth2 access token.
CkOAuth2W oauth2;
oauth2.put_AccessToken(L"OAUTH2_ACCESS_TOKEN");
rest.SetAuthOAuth2(oauth2);
success = rest.Connect(L"www.googleapis.com",443,true,true);
if (success != true) {
wprintf(L"%s\n",rest.lastErrorText());
return;
}
CkStringBuilderW sbJson;
success = rest.FullRequestNoBodySb(L"GET",L"/calendar/v3/calendars/support@chilkatcloud.com/events/6li3bfqqq65edprt4ms6vdld2j/instances",sbJson);
if (success != true) {
wprintf(L"%s\n",rest.lastErrorText());
return;
}
if (rest.get_ResponseStatusCode() != 200) {
wprintf(L"Received error response code: %d\n",rest.get_ResponseStatusCode());
wprintf(L"Response body:\n");
wprintf(L"%s\n",sbJson.getAsString());
return;
}
CkJsonObjectW json;
json.LoadSb(sbJson);
// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.
const wchar_t *kind = 0;
const wchar_t *etag = 0;
const wchar_t *summary = 0;
const wchar_t *updated = 0;
const wchar_t *timeZone = 0;
const wchar_t *accessRole = 0;
const wchar_t *nextSyncToken = 0;
int i;
int count_i;
const wchar_t *method = 0;
int minutes;
const wchar_t *id = 0;
const wchar_t *status = 0;
const wchar_t *htmlLink = 0;
const wchar_t *created = 0;
const wchar_t *description = 0;
const wchar_t *location = 0;
const wchar_t *creatorEmail = 0;
bool creatorSelf;
const wchar_t *organizerEmail = 0;
bool organizerSelf;
const wchar_t *startDateTime = 0;
const wchar_t *startTimeZone = 0;
const wchar_t *endDateTime = 0;
const wchar_t *endTimeZone = 0;
const wchar_t *recurringEventId = 0;
const wchar_t *originalStartTimeDateTime = 0;
const wchar_t *originalStartTimeTimeZone = 0;
const wchar_t *iCalUID = 0;
int sequence;
const wchar_t *hangoutLink = 0;
bool remindersUseDefault;
int j;
int count_j;
kind = json.stringOf(L"kind");
etag = json.stringOf(L"etag");
summary = json.stringOf(L"summary");
updated = json.stringOf(L"updated");
timeZone = json.stringOf(L"timeZone");
accessRole = json.stringOf(L"accessRole");
nextSyncToken = json.stringOf(L"nextSyncToken");
i = 0;
count_i = json.SizeOfArray(L"defaultReminders");
while (i < count_i) {
json.put_I(i);
method = json.stringOf(L"defaultReminders[i].method");
minutes = json.IntOf(L"defaultReminders[i].minutes");
i = i + 1;
}
i = 0;
count_i = json.SizeOfArray(L"items");
while (i < count_i) {
json.put_I(i);
kind = json.stringOf(L"items[i].kind");
etag = json.stringOf(L"items[i].etag");
id = json.stringOf(L"items[i].id");
status = json.stringOf(L"items[i].status");
htmlLink = json.stringOf(L"items[i].htmlLink");
created = json.stringOf(L"items[i].created");
updated = json.stringOf(L"items[i].updated");
summary = json.stringOf(L"items[i].summary");
description = json.stringOf(L"items[i].description");
location = json.stringOf(L"items[i].location");
creatorEmail = json.stringOf(L"items[i].creator.email");
creatorSelf = json.BoolOf(L"items[i].creator.self");
organizerEmail = json.stringOf(L"items[i].organizer.email");
organizerSelf = json.BoolOf(L"items[i].organizer.self");
startDateTime = json.stringOf(L"items[i].start.dateTime");
startTimeZone = json.stringOf(L"items[i].start.timeZone");
endDateTime = json.stringOf(L"items[i].end.dateTime");
endTimeZone = json.stringOf(L"items[i].end.timeZone");
recurringEventId = json.stringOf(L"items[i].recurringEventId");
originalStartTimeDateTime = json.stringOf(L"items[i].originalStartTime.dateTime");
originalStartTimeTimeZone = json.stringOf(L"items[i].originalStartTime.timeZone");
iCalUID = json.stringOf(L"items[i].iCalUID");
sequence = json.IntOf(L"items[i].sequence");
hangoutLink = json.stringOf(L"items[i].hangoutLink");
remindersUseDefault = json.BoolOf(L"items[i].reminders.useDefault");
j = 0;
count_j = json.SizeOfArray(L"items[i].reminders.overrides");
while (j < count_j) {
json.put_J(j);
method = json.stringOf(L"items[i].reminders.overrides[j].method");
minutes = json.IntOf(L"items[i].reminders.overrides[j].minutes");
j = j + 1;
}
i = i + 1;
}
wprintf(L"Example Completed.\n");
}
{
"kind": "calendar#events",
"etag": "\"p33se7k7armnte0g\"",
"summary": "support@chilkatcloud.com",
"updated": "2017-11-08T19:40:49.131Z",
"timeZone": "America/Chicago",
"accessRole": "owner",
"defaultReminders": [
{
"method": "popup",
"minutes": 10
}
],
"nextSyncToken": "CPjj0Ordr9cCEPjj0Ordr9cCGAU=",
"items": [
{
"kind": "calendar#event",
"etag": "\"3020339874608000\"",
"id": "6li3bfqqq65edprt4ms6vdld2j_20171111T000000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NmxpM2JmcXFxNjVlZHBydDRtczZ2ZGxkMmpfMjAxNzExMTFUMDAwMDAwWiBzdXBwb3J0QGNoaWxrYXRjbG91ZC5jb20",
"created": "2017-11-08T19:35:30.000Z",
"updated": "2017-11-08T19:40:49.019Z",
"summary": "TGIF Happy Hour",
"description": "Friday Night Happy Hour",
"location": "Shannon's Irish Pub, 428 N Main St, Glen Ellyn, IL 60137, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-10T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"end": {
"dateTime": "2017-11-10T19:00:00-06:00",
"timeZone": "America/Chicago"
},
"recurringEventId": "6li3bfqqq65edprt4ms6vdld2j",
"originalStartTime": {
"dateTime": "2017-11-10T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"iCalUID": "6li3bfqqq65edprt4ms6vdld2j@google.com",
"sequence": 1,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.6li3bfqqq65edprt4ms6vdld2j",
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "popup",
"minutes": 180
}
]
}
},
{
"kind": "calendar#event",
"etag": "\"3020339874608000\"",
"id": "6li3bfqqq65edprt4ms6vdld2j_20171118T000000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NmxpM2JmcXFxNjVlZHBydDRtczZ2ZGxkMmpfMjAxNzExMThUMDAwMDAwWiBzdXBwb3J0QGNoaWxrYXRjbG91ZC5jb20",
"created": "2017-11-08T19:35:30.000Z",
"updated": "2017-11-08T19:40:49.019Z",
"summary": "TGIF Happy Hour",
"description": "Friday Night Happy Hour",
"location": "Shannon's Irish Pub, 428 N Main St, Glen Ellyn, IL 60137, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-17T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"end": {
"dateTime": "2017-11-17T19:00:00-06:00",
"timeZone": "America/Chicago"
},
"recurringEventId": "6li3bfqqq65edprt4ms6vdld2j",
"originalStartTime": {
"dateTime": "2017-11-17T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"iCalUID": "6li3bfqqq65edprt4ms6vdld2j@google.com",
"sequence": 1,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.6li3bfqqq65edprt4ms6vdld2j",
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "popup",
"minutes": 180
}
]
}
},
{
"kind": "calendar#event",
"etag": "\"3020339874608000\"",
"id": "6li3bfqqq65edprt4ms6vdld2j_20171125T000000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NmxpM2JmcXFxNjVlZHBydDRtczZ2ZGxkMmpfMjAxNzExMjVUMDAwMDAwWiBzdXBwb3J0QGNoaWxrYXRjbG91ZC5jb20",
"created": "2017-11-08T19:35:30.000Z",
"updated": "2017-11-08T19:40:49.019Z",
"summary": "TGIF Happy Hour",
"description": "Friday Night Happy Hour",
"location": "Shannon's Irish Pub, 428 N Main St, Glen Ellyn, IL 60137, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-24T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"end": {
"dateTime": "2017-11-24T19:00:00-06:00",
"timeZone": "America/Chicago"
},
"recurringEventId": "6li3bfqqq65edprt4ms6vdld2j",
"originalStartTime": {
"dateTime": "2017-11-24T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"iCalUID": "6li3bfqqq65edprt4ms6vdld2j@google.com",
"sequence": 1,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.6li3bfqqq65edprt4ms6vdld2j",
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "popup",
"minutes": 180
}
]
}
},
{
"kind": "calendar#event",
"etag": "\"3020339874608000\"",
"id": "6li3bfqqq65edprt4ms6vdld2j_20171202T000000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NmxpM2JmcXFxNjVlZHBydDRtczZ2ZGxkMmpfMjAxNzEyMDJUMDAwMDAwWiBzdXBwb3J0QGNoaWxrYXRjbG91ZC5jb20",
"created": "2017-11-08T19:35:30.000Z",
"updated": "2017-11-08T19:40:49.019Z",
"summary": "TGIF Happy Hour",
"description": "Friday Night Happy Hour",
"location": "Shannon's Irish Pub, 428 N Main St, Glen Ellyn, IL 60137, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-12-01T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"end": {
"dateTime": "2017-12-01T19:00:00-06:00",
"timeZone": "America/Chicago"
},
"recurringEventId": "6li3bfqqq65edprt4ms6vdld2j",
"originalStartTime": {
"dateTime": "2017-12-01T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"iCalUID": "6li3bfqqq65edprt4ms6vdld2j@google.com",
"sequence": 1,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.6li3bfqqq65edprt4ms6vdld2j",
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "popup",
"minutes": 180
}
]
}
}
]
}