Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating the same event after removing causes 409 error

I'm writing an app which adds events from our server to user's Google Calendar using API. And I encountered a HTTP 409 Conflict error following this scenario:

  1. Create an event with some explicitly defined ID / Events: insert
  2. Delete the event / Events: delete
  3. Try to create event with the same ID - get the error.

This scenario can come true when:

  1. a user exports events from our server.
  2. one of the events (say with ID = 1) will be disabled on our server
  3. the user exports again the events - this disabled event will removed from user's Google Calendar / API call: delete, eventId = 1
  4. the disabled event will be enabled again
  5. the user performs export - API insert request will be fired with the same ID = 1 . And error 409 will be raised. / API call: insert, eventId = 1

It seems that an event in fact isn't removed after invoking delete API method. Is there any workaround for this issue?

like image 556
Vasily Avatar asked Dec 18 '14 09:12

Vasily


1 Answers

It turned out that the so-called "delete" operation in fact doesn't delete events, just hides them and changes their status to "canceled". So events continue to exist in Google Calendar.
As a workaround I retrieve deleted entries using "showDeleted" = true option and update them.

like image 53
Vasily Avatar answered Sep 29 '22 09:09

Vasily