I'm trying to update an event in Google Calendar using JavaScript and just cannot seem to achieve a simple update of specific variables I specify. The code below is what I've tried so far along with other similar combinations:
var event = {};
// Example showing a change in the location
event = {"location": "New Address"};
var request = gapi.client.calendar.events.update({
'calendarId': 'primary',
'eventId': booking.eventCalendarId, // Event ID stored in database
'resource': event
});
request.execute(function (event) {
console.log(event);
});
Regardless of the API Reference I've attempted to follow, I've tried getting the event itself and passing that reference to attempt to update specific variables. However, using the closest working sample code above I've noticed the console advises that I'm missing the start and end dates as minimum parameters. I obviously can add this to the 'event' object, yet this isn't effective as I only wish to update the fields I specify. The only other option is simply deleting the event and creating a new one - there must be a simpler way or there is something I have completely missed out entirely.