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"
LOCAL loRest
LOCAL lnSuccess
LOCAL loOauth2
LOCAL loSbJson
LOCAL loJson
LOCAL lcKind
LOCAL lcEtag
LOCAL lcId
LOCAL lcStatus
LOCAL lcHtmlLink
LOCAL lcCreated
LOCAL lcUpdated
LOCAL lcSummary
LOCAL lcLocation
LOCAL lcCreatorEmail
LOCAL lnCreatorSelf
LOCAL lcOrganizerEmail
LOCAL lnOrganizerSelf
LOCAL lcStartDateTime
LOCAL lcEndDateTime
LOCAL lcICalUID
LOCAL lnSequence
LOCAL lcHangoutLink
LOCAL lnRemindersUseDefault
LOCAL i
LOCAL lnCount_i
LOCAL lcEmail
LOCAL lcResponseStatus
LOCAL lnOrganizer
LOCAL lnSelf
loRest = CreateObject('Chilkat_9_5_0.Rest')
* Provide a previously obtained OAuth2 access token.
loOauth2 = CreateObject('Chilkat_9_5_0.OAuth2')
loOauth2.AccessToken = "OAUTH2_ACCESS_TOKEN"
loRest.SetAuthOAuth2(loOauth2)
lnSuccess = loRest.Connect("www.googleapis.com",443,1,1)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loOauth2
CANCEL
ENDIF
loSbJson = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("GET","/calendar/v3/calendars/support@chilkatcloud.com/events/35ocdnnjofbtfs6c602uqvdg9u",loSbJson)
IF (lnSuccess <> 1) THEN
? loRest.LastErrorText
RELEASE loRest
RELEASE loOauth2
RELEASE loSbJson
CANCEL
ENDIF
IF (loRest.ResponseStatusCode <> 200) THEN
? "Received error response code: " + STR(loRest.ResponseStatusCode)
? "Response body:"
? loSbJson.GetAsString()
RELEASE loRest
RELEASE loOauth2
RELEASE loSbJson
CANCEL
ENDIF
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.LoadSb(loSbJson)
* The following code parses the JSON response.
* A sample JSON response is shown below the sample code.
lcKind = loJson.StringOf("kind")
lcEtag = loJson.StringOf("etag")
lcId = loJson.StringOf("id")
lcStatus = loJson.StringOf("status")
lcHtmlLink = loJson.StringOf("htmlLink")
lcCreated = loJson.StringOf("created")
lcUpdated = loJson.StringOf("updated")
lcSummary = loJson.StringOf("summary")
lcLocation = loJson.StringOf("location")
lcCreatorEmail = loJson.StringOf("creator.email")
lnCreatorSelf = loJson.BoolOf("creator.self")
lcOrganizerEmail = loJson.StringOf("organizer.email")
lnOrganizerSelf = loJson.BoolOf("organizer.self")
lcStartDateTime = loJson.StringOf("start.dateTime")
lcEndDateTime = loJson.StringOf("end.dateTime")
lcICalUID = loJson.StringOf("iCalUID")
lnSequence = loJson.IntOf("sequence")
lcHangoutLink = loJson.StringOf("hangoutLink")
lnRemindersUseDefault = loJson.BoolOf("reminders.useDefault")
i = 0
lnCount_i = loJson.SizeOfArray("attendees")
DO WHILE i < lnCount_i
loJson.I = i
lcEmail = loJson.StringOf("attendees[i].email")
lcResponseStatus = loJson.StringOf("attendees[i].responseStatus")
lnOrganizer = loJson.BoolOf("attendees[i].organizer")
lnSelf = loJson.BoolOf("attendees[i].self")
i = i + 1
ENDDO
? "Example Completed."
RELEASE loRest
RELEASE loOauth2
RELEASE loSbJson
RELEASE loJson
{
"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
}
}