1

Via the Google API explorer I can access my public calendar events list with the calendar id. So I know that much is right

https://developers.google.com/google-apps/calendar/v3/reference/events/list

The GET example they used looks like this:

GET
https://www.googleapis.com/calendar/v3/calendars/iu8chrc23t5nuejb3q28lt970o%40group.calendar.google.com/events?key={YOUR_API_KEY}

X-JavaScript-User-Agent:  Google APIs Explorer

My understanding is that all I need to do is stick my API key into the part that says YOUR_API_KEY and I should be able to retrieve the correct response by simply putting that url into my browser.

Let's say my API key was ABCDEF1234

then I paste this into the browser and press go:

https://www.googleapis.com/calendar/v3/calendars/iu8chrc23t5nuejb3q28lt970o%40group.calendar.google.com/events?key={ABCDEF1234}

The response I get unfortunately tells me that something went wrong

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "keyInvalid",
    "message": "Bad Request"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

At first I thought I hadn't waited long enough for the Key to get activated but it's been more than 24 hours now so I'm not sure why the key would be invalid.

In response to the answer to this question, I'm certain that I'm using the public key.

My only lead on this is that the API key is associated with a google 'project', but my simple GET request is not. My final application is a simple static webpage with a tiny script in it to display upcoming calendar events so the examples given for Java, PHP, Ruby, Python etc don't apply.

Summary: Public Calendar, simple access of upcoming events in API v3 (I was doing this in v2 before).

Community
  • 1
  • 1
KCE
  • 1,159
  • 8
  • 25
  • you can publish the cal to rss/xml and use a tool like YQL to consume the XML and turn it into jsonp, which you can fetch onto your page and then turn into html. – dandavis Dec 09 '14 at 21:58
  • Interesting. I was previously using the Google data JS client library to retrieve a calendar feed through the v2 API. Looking at YQL it seems similar. Are you suggesting that using the v3 API isn't feasible with a simple HTML/JS site like mine, or are you saying that I'd be better off using an XML query like YQL for some other reason? Thanks for the feedback! – KCE Dec 09 '14 at 23:14
  • i haven't kept up with the changes to the API, i'm just reporting what's worked for me in the past and seems possible today. – dandavis Dec 10 '14 at 00:16

1 Answers1

3

I know that this question is quite old but maybe it helps other people who stumble across the same thing (like me).

Solution: The curly braces also have to be replaced. So your request in particular should look like this: https://www.googleapis.com/calendar/v3/calendars/iu8chrc23t5nuejb3q28lt970o%40group.calendar.google.com/events?key=ABCDEF1234

Otherwise you will get the shown error message. Also, make sure that the used calendar is public. If it's not, you will get the following error message:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "Not Found"
   }
  ],
  "code": 404,
  "message": "Not Found"
 }
}
Lorion
  • 310
  • 2
  • 10
  • Marking as answer just because you took the time to respond rather than because I can confirm it's right :) If by some chance someone else comes to this and finds it doesn't work for them, by all means let us know. – KCE Aug 19 '19 at 06:07