Sample Google Calendar API fetch


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:
You will need to use the CalendarID (from the calendar page), and you will need your own API Key:




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

#set($myjson = $json.fetch("${usedate}&key={redacted for security reasons-get your own API code}"))

#foreach ($item in $myjson.get("items"))

 $item.get("summary")  || $item.get("start")<br>


Have you created code you'd like to share with the dotCMS community?

Share your code Become a Contributor