Returns a specified event from a specified calendar.
This example gets an event from the calendar having the ID = "support@chilkatcloud.com", where the event ID equals "35ocdnnjofbtfs6c602uqvdg9u"
load ./chilkat.dll
set rest [new_CkRest]
# Provide a previously obtained OAuth2 access token.
set oauth2 [new_CkOAuth2]
CkOAuth2_put_AccessToken $oauth2 "OAUTH2_ACCESS_TOKEN"
CkRest_SetAuthOAuth2 $rest $oauth2
set success [CkRest_Connect $rest "www.googleapis.com" 443 1 1]
if {[expr $success != 1]} then {
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
delete_CkOAuth2 $oauth2
exit
}
set sbJson [new_CkStringBuilder]
set success [CkRest_FullRequestNoBodySb $rest "GET" "/calendar/v3/calendars/support@chilkatcloud.com/events/35ocdnnjofbtfs6c602uqvdg9u" $sbJson]
if {[expr $success != 1]} then {
puts [CkRest_lastErrorText $rest]
delete_CkRest $rest
delete_CkOAuth2 $oauth2
delete_CkStringBuilder $sbJson
exit
}
if {[expr [CkRest_ResponseStatusCode $rest] != 200]} then {
puts "Received error response code: [CkRest_ResponseStatusCode $rest]"
puts "Response body:"
puts [CkStringBuilder_getAsString $sbJson]
delete_CkRest $rest
delete_CkOAuth2 $oauth2
delete_CkStringBuilder $sbJson
exit
}
set json [new_CkJsonObject]
CkJsonObject_LoadSb $json $sbJson
# The following code parses the JSON response.
# A sample JSON response is shown below the sample code.
set kind [CkJsonObject_stringOf $json "kind"]
set etag [CkJsonObject_stringOf $json "etag"]
set id [CkJsonObject_stringOf $json "id"]
set status [CkJsonObject_stringOf $json "status"]
set htmlLink [CkJsonObject_stringOf $json "htmlLink"]
set created [CkJsonObject_stringOf $json "created"]
set updated [CkJsonObject_stringOf $json "updated"]
set summary [CkJsonObject_stringOf $json "summary"]
set location [CkJsonObject_stringOf $json "location"]
set creatorEmail [CkJsonObject_stringOf $json "creator.email"]
set creatorSelf [CkJsonObject_BoolOf $json "creator.self"]
set organizerEmail [CkJsonObject_stringOf $json "organizer.email"]
set organizerSelf [CkJsonObject_BoolOf $json "organizer.self"]
set startDateTime [CkJsonObject_stringOf $json "start.dateTime"]
set endDateTime [CkJsonObject_stringOf $json "end.dateTime"]
set iCalUID [CkJsonObject_stringOf $json "iCalUID"]
set sequence [CkJsonObject_IntOf $json "sequence"]
set hangoutLink [CkJsonObject_stringOf $json "hangoutLink"]
set remindersUseDefault [CkJsonObject_BoolOf $json "reminders.useDefault"]
set i 0
set count_i [CkJsonObject_SizeOfArray $json "attendees"]
while {[expr $i < $count_i]} {
CkJsonObject_put_I $json $i
set email [CkJsonObject_stringOf $json "attendees[i].email"]
set responseStatus [CkJsonObject_stringOf $json "attendees[i].responseStatus"]
set organizer [CkJsonObject_BoolOf $json "attendees[i].organizer"]
set self [CkJsonObject_BoolOf $json "attendees[i].self"]
set i [expr $i + 1]
}
puts "Example Completed."
delete_CkRest $rest
delete_CkOAuth2 $oauth2
delete_CkStringBuilder $sbJson
delete_CkJsonObject $json
{
"kind": "calendar#event",
"etag": "\"3020331471326000\"",
"id": "35ocdnnjofbtfs6c602uqvdg9u",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MzVvY2RubmpvZmJ0ZnM2YzYwMnVxdmRnOXUgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-08T18:25:38.000Z",
"updated": "2017-11-08T18:28:55.663Z",
"summary": "QXQC",
"location": "Quigley's Irish Pub, 43 E Jefferson Ave, Naperville, IL 60540, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-09T20:00:00-06:00"
},
"end": {
"dateTime": "2017-11-09T23:00:00-06:00"
},
"iCalUID": "35ocdnnjofbtfs6c602uqvdg9u@google.com",
"sequence": 0,
"attendees": [
{
"email": "dean@example.com",
"responseStatus": "needsAction"
},
{
"email": "support@chilkatcloud.com",
"organizer": true,
"self": true,
"responseStatus": "accepted"
},
{
"email": "ajay@example.com",
"responseStatus": "needsAction"
},
{
"email": "jim@example.com",
"responseStatus": "needsAction"
},
{
"email": "gilian@example.com",
"responseStatus": "needsAction"
}
],
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.35ocdnnjofbtfs6c602uqvdg9u",
"reminders": {
"useDefault": true
}
}