Read-only access to public Google Calendar using simple, unauthenticated REST calls

1,663 views
Skip to first unread message

Northk

unread,
Dec 29, 2012, 11:12:30 PM12/29/12
to google-ca...@googlegroups.com
Greetings all,

I want to get read-only access to a public Google Calendar list of events with their details, using PHP. The OAuth stuff in Google's client API for PHP is very complicated and frankly I don't get it. However I can easily get JSON results in my browser by simply entering a URL in the form https://www.googleapis.com/calendar/v3/calendars/{the public calendar ID}/events?key={my developer key from Google API Console}.

I'm wondering why I couldn't just write some simple cURL code in PHP that creates the proper Google API REST URL as above, and then parse the JSON results-- without having to go through all the OAuth crap...er complexity :) Am I missing something? Is there some kind of quota limit on unauthenticated API requests or some other gotcha that I don't know about? Please let me know your thoughts.

Thanks,
-Northk

Ray Baxter

unread,
Dec 31, 2012, 12:17:25 AM12/31/12
to google-ca...@googlegroups.com
If you are reading a public calendar, you don't need to authenticate. I can't check right now, but last I looked, you don't need a developer key either. 

Ray


--
You received this message because you are subscribed to the Google Groups "Google Calendar API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-calendar-api/-/q5Px1qc8I58J.
To post to this group, send email to google-ca...@googlegroups.com.
To unsubscribe from this group, send email to google-calendar...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-calendar-api?hl=en.

Northk

unread,
Dec 31, 2012, 11:21:22 AM12/31/12
to google-ca...@googlegroups.com
Thanks Ray.

I've got things working so that I can execute a REST call wrapped in cURL, to get the public calendar feed. I'm using json_decode() to parse the results. It seems to work well. I'm still using a developer key but I'll try taking that out and seeing if it still works. 

I'd like to see Google document this approach better - they suggest that you can use REST but they don't say the calls need not be authenticated and they don't give any examples using PHP. The only thing remaining is to cache the results in a DB so the REST call doesn't have to be executed every time a visitor browses to the page.
Reply all
Reply to author
Forward
0 new messages