1

I'm using Google API v3 for Google Calendar. I'm able to add a recurrent event to Google Calendar but when trying to delete only the first occurrence of the series, the whole series gets deleted.

I'm using Python and authomatic_inst library and I'm passing the event_id as follows: baseID_yyyymmddThhmmssZ

The delete request acts as if I only passed the baseID but I've checked the whole ID (ID with date and time) is passed.

I've used this reference (https://developers.google.com/google-apps/calendar/v3/reference/events) to retrieve the instances of the series and make sure the id of the first event is correct, but although deleting it from the try it! tool works, it does not work for me from Python.

def delete_gcal_event(google_event_id):
# google_event_id in the form baseID_yyyymmddThhmmssZ
# Deserialize the user's API credentials from the session storage
credentials = authomatic_inst.credentials(session['google_credentials'])

if not credentials.valid:
    credentials.refresh()
    session['google_credentials'] = credentials.serialize()

response = authomatic_inst.access(
                credentials,
                api_url('calendars/{}/events/{}', 'primary', google_event_id),
                method='DELETE',
                headers=JSON_HEADERS)

if (response.status == 204):
    return dict(success = True,
                message = "Event deleted successfully",
                status = response.status)
else:
    return dict(success = False,
                message = "Error when deleting event from google",
                status = response.status)

Did anyone came across this issue before?

Many thanks, Javier

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Javier PR
  • 615
  • 6
  • 13
  • Could you please post the code for your best attempt? Thanks. – lrnzcig May 11 '16 at 16:42
  • Sure! Updated, thanks – Javier PR May 11 '16 at 17:37
  • Check this [SO question](http://stackoverflow.com/questions/28219601/how-to-read-events-and-delete-all-events-in-google-calendar-using-api-v3-php) although the code is in PHP and this [documentation](https://developers.google.com/google-apps/calendar/v3/reference/events/delete) if it can help you ;) – KENdi May 12 '16 at 06:52
  • Thanks @KENdi, but I think the question wasn't clear enough. I can delete events normally except for the first one in a series of recurrent events, I hope the changes I've made to the question clarifies it a bit. – Javier PR May 12 '16 at 07:38
  • I just tried to reproduce this and could not. When I used the event ID of the first instance: 0mblab2g0mdc2sec77f3n7n734_20160513T070000Z only this instance was deleted. Would you try in API explorer (https://developers.google.com/apis-explorer/#s/calendar/v3/ ) whether it reproduces for you? – luc May 12 '16 at 08:10
  • Thanks for your answer @luc. I couldn't reproduce it either. What I could do was checking the complete google ID returned by the API explorer with the one I'm passing to my application. They are exactly the same but the request sent from the application is still deleting the whole series – Javier PR May 12 '16 at 12:26
  • Yes and you can also try looking at the request your app sends and compare to the one from the explorer. – luc May 12 '16 at 13:42
  • Yes, I've done that too and they look exactly the same. – Javier PR May 12 '16 at 14:12

0 Answers0