Sample Google Calendar API fetch

Description

A working copy of a JSON fetch from the Google Calendar API.

 

The most useful resource/page I found was here - it allows you to generate the JSON query - keep scrolling, the tool is at the bottom of the page:
https://developers.google.com/google-apps/calendar/v3/reference/events/list#examples
 
You will need to use the CalendarID (from the calendar page), and you will need your own API Key:
https://developers.google.com/google-apps/calendar/firstapp

 

 

Code

${esc.hash}set (${esc.dollar}RSTdate=${esc.dollar}date.get('yyyy-MM-dd'))
${esc.hash}set (${esc.dollar}RSTdate=${esc.dollar}RSTdate+"T05:00:00.000-04:00")
${esc.hash}set (${esc.dollar}usedate=${esc.dollar}UtilMethods.encodeURL(${esc.dollar}RSTdate))
${esc.hash}${esc.hash}Need the date in RST3339 timestamp


${esc.hash}set(${esc.dollar}myjson = ${esc.dollar}json.fetch("https://www.googleapis.com/calendar/v3/calendars/m.marywood.edu_f5qiptk2okvpe4m1mt43hmhegg%40group.calendar.google.com/events?maxResults=5&timeMin=${esc.dollar}{usedate}&key={redacted for security reasons-get your own API code}"))


${esc.hash}foreach (${esc.dollar}item in ${esc.dollar}myjson.get("items"))

 ${esc.dollar}item.get("summary")  || ${esc.dollar}item.get("start")<br>

${esc.hash}end