I had my Google calendar application almost working, I am still able to list all the events on the Primary Calendar and I can edit on Google and see the updated results on my calendar.
The problem is that my:
var eventToUpdate = gapi.client.calendar.events.get({
is getting an error 404.
From what I've been reading people who have had this issue previously were sending the wrong Key or wrong Event ID. But I've tested the values using
https://developers.google.com/calendar/v3/reference/events/update
& I get a success 200 back from Google.
Here is my event drop:
eventDrop: function( eventDropInfo ) {
gapi.auth.setToken('<?php echo $google_auth['access_token']; ?>');
handleAuthClick;
gapi.client.init({
apiKey: API_KEY,
clientId: CLIENT_ID,
discoveryDocs: DISCOVERY_DOCS,
scope: SCOPES
}).then(function () {
}, function(error) {
appendPre(JSON.stringify(error, null, 2));
});
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
var eventToUpdate = gapi.client.calendar.events.get({
"calendarId": 'primary',
"eventId": eventDropInfo.id
});
There's more but that's the main Google APIs part.
I thought it could be the Key, however the Key works to grab the calendar information and is able to be used for my other Google stuff. (Drive, Login etc.)
I thought maybee it was the wrong calendar ID but using the Google "Try This API" It seems the Calendar ID + Event ID is perfect as Google gives me success.
Below you can see the console error, apologies if I've missed off anything important.
Thank You!
Error 404 From Console --- Updated with more info
This shows Google References accepting the event ID and updating the event
This is the data I've entered to get the 200 success above
This is the URL showing the JSON google print out
Just to note, I've checked the scopes and the 2 I am using are:
var SCOPES = "https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events";
The only others I can find are Read Only so I doubt it's the scopes.
Also the code seems to work as the only error I see is Google giving a 404, the loading of the events and calendar work it's just update that gives the 404.
As you can see through the screenshots I've updated the event ID i'm using to test is the same in my code as in the References test.
scopes
are you using? Maybe calendar information is a more restrictive scope than event details. – user835611get
instead of forupdate
to see if it works? – user835611