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"
IncludeFile "CkJsonObject.pb"
IncludeFile "CkStringBuilder.pb"
IncludeFile "CkRest.pb"
IncludeFile "CkOAuth2.pb"
Procedure ChilkatExample()
rest.i = CkRest::ckCreate()
If rest.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
; Provide a previously obtained OAuth2 access token.
oauth2.i = CkOAuth2::ckCreate()
If oauth2.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkOAuth2::setCkAccessToken(oauth2, "OAUTH2_ACCESS_TOKEN")
CkRest::ckSetAuthOAuth2(rest,oauth2)
success = CkRest::ckConnect(rest,"www.googleapis.com",443,1,1)
If success <> 1
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
CkOAuth2::ckDispose(oauth2)
ProcedureReturn
EndIf
sbJson.i = CkStringBuilder::ckCreate()
If sbJson.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkRest::ckFullRequestNoBodySb(rest,"GET","/calendar/v3/calendars/support@chilkatcloud.com/events/6li3bfqqq65edprt4ms6vdld2j/instances",sbJson)
If success <> 1
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
CkOAuth2::ckDispose(oauth2)
CkStringBuilder::ckDispose(sbJson)
ProcedureReturn
EndIf
If CkRest::ckResponseStatusCode(rest) <> 200
Debug "Received error response code: " + Str(CkRest::ckResponseStatusCode(rest))
Debug "Response body:"
Debug CkStringBuilder::ckGetAsString(sbJson)
CkRest::ckDispose(rest)
CkOAuth2::ckDispose(oauth2)
CkStringBuilder::ckDispose(sbJson)
ProcedureReturn
EndIf
json.i = CkJsonObject::ckCreate()
If json.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckLoadSb(json,sbJson)
; The following code parses the JSON response.
; A sample JSON response is shown below the sample code.
kind.s
etag.s
summary.s
updated.s
timeZone.s
accessRole.s
nextSyncToken.s
i.i
count_i.i
method.s
minutes.i
id.s
status.s
htmlLink.s
created.s
description.s
location.s
creatorEmail.s
creatorSelf.i
organizerEmail.s
organizerSelf.i
startDateTime.s
startTimeZone.s
endDateTime.s
endTimeZone.s
recurringEventId.s
originalStartTimeDateTime.s
originalStartTimeTimeZone.s
iCalUID.s
sequence.i
hangoutLink.s
remindersUseDefault.i
j.i
count_j.i
kind = CkJsonObject::ckStringOf(json,"kind")
etag = CkJsonObject::ckStringOf(json,"etag")
summary = CkJsonObject::ckStringOf(json,"summary")
updated = CkJsonObject::ckStringOf(json,"updated")
timeZone = CkJsonObject::ckStringOf(json,"timeZone")
accessRole = CkJsonObject::ckStringOf(json,"accessRole")
nextSyncToken = CkJsonObject::ckStringOf(json,"nextSyncToken")
i = 0
count_i = CkJsonObject::ckSizeOfArray(json,"defaultReminders")
While i < count_i
CkJsonObject::setCkI(json, i)
method = CkJsonObject::ckStringOf(json,"defaultReminders[i].method")
minutes = CkJsonObject::ckIntOf(json,"defaultReminders[i].minutes")
i = i + 1
Wend
i = 0
count_i = CkJsonObject::ckSizeOfArray(json,"items")
While i < count_i
CkJsonObject::setCkI(json, i)
kind = CkJsonObject::ckStringOf(json,"items[i].kind")
etag = CkJsonObject::ckStringOf(json,"items[i].etag")
id = CkJsonObject::ckStringOf(json,"items[i].id")
status = CkJsonObject::ckStringOf(json,"items[i].status")
htmlLink = CkJsonObject::ckStringOf(json,"items[i].htmlLink")
created = CkJsonObject::ckStringOf(json,"items[i].created")
updated = CkJsonObject::ckStringOf(json,"items[i].updated")
summary = CkJsonObject::ckStringOf(json,"items[i].summary")
description = CkJsonObject::ckStringOf(json,"items[i].description")
location = CkJsonObject::ckStringOf(json,"items[i].location")
creatorEmail = CkJsonObject::ckStringOf(json,"items[i].creator.email")
creatorSelf = CkJsonObject::ckBoolOf(json,"items[i].creator.self")
organizerEmail = CkJsonObject::ckStringOf(json,"items[i].organizer.email")
organizerSelf = CkJsonObject::ckBoolOf(json,"items[i].organizer.self")
startDateTime = CkJsonObject::ckStringOf(json,"items[i].start.dateTime")
startTimeZone = CkJsonObject::ckStringOf(json,"items[i].start.timeZone")
endDateTime = CkJsonObject::ckStringOf(json,"items[i].end.dateTime")
endTimeZone = CkJsonObject::ckStringOf(json,"items[i].end.timeZone")
recurringEventId = CkJsonObject::ckStringOf(json,"items[i].recurringEventId")
originalStartTimeDateTime = CkJsonObject::ckStringOf(json,"items[i].originalStartTime.dateTime")
originalStartTimeTimeZone = CkJsonObject::ckStringOf(json,"items[i].originalStartTime.timeZone")
iCalUID = CkJsonObject::ckStringOf(json,"items[i].iCalUID")
sequence = CkJsonObject::ckIntOf(json,"items[i].sequence")
hangoutLink = CkJsonObject::ckStringOf(json,"items[i].hangoutLink")
remindersUseDefault = CkJsonObject::ckBoolOf(json,"items[i].reminders.useDefault")
j = 0
count_j = CkJsonObject::ckSizeOfArray(json,"items[i].reminders.overrides")
While j < count_j
CkJsonObject::setCkJ(json, j)
method = CkJsonObject::ckStringOf(json,"items[i].reminders.overrides[j].method")
minutes = CkJsonObject::ckIntOf(json,"items[i].reminders.overrides[j].minutes")
j = j + 1
Wend
i = i + 1
Wend
Debug "Example Completed."
CkRest::ckDispose(rest)
CkOAuth2::ckDispose(oauth2)
CkStringBuilder::ckDispose(sbJson)
CkJsonObject::ckDispose(json)
ProcedureReturn
EndProcedure
{
"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
}
]
}
}
]
}