Get JSON from a public Google Calendar

google-calendar-api, json, php

Solution

Your calendar have to be shared publicly! This one works if you have shared only free/busy status:

http://www.google.com/calendar/feeds/{calendarId}@group.calendar.google.com/public/basic?orderby=starttime&sortorder=ascending&futureevents=true&alt=json

Full details - this one works only if calendar is shared fully publicly

http://www.google.com/calendar/feeds/{calendarId}@group.calendar.google.com/public/full?orderby=starttime&sortorder=ascending&futureevents=true&alt=json

Or just free-busy

http://www.google.com/calendar/feeds/{calendarId}@group.calendar.google.com/public/free-busy?orderby=starttime&sortorder=ascending&futureevents=true&alt=json

Parameters orderby, sortorder and futureevents are optional but might help you later :)

Problem

How can I get a `JSON` with the events of a public Google Calendar? I have it's `ID` but no acess to it. I don't want to change its events, nor log in. I would like get a `JSON` from it to sync with my `PHP`/`MySql` database. Tried `https://www.googleapis.com/calendar/v3/calendars/{calendarId}` but got login error: ``` { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } } ```

Original source

Related problems