Creating the same event after deleting the cause of error 409

I am writing an application that adds events from our server to a custom Google Calendar using the API. And I ran into HTTP 409 Conflict error after this script:

  • Create an event with a specific, explicitly defined ID / Events: insert
  • Delete event / Events: delete
  • Try to create an event with the same identifier - get an error.

This script can be executed when:

  • user exports events from our server.
  • one of the events (for example, with ID = 1) will be disabled on our server
  • the user exports events again - this disabled event will be deleted from the Google Calendar user / API call: delete, eventId = 1
  • a disabled event will be enabled again
  • the user performs the export - the API insert request will be launched with the same ID = 1. And the 409 error will be raised. / API call: insert, eventId = 1

It seems that the event is not actually deleted after calling the deleteAPI method . Is there any workaround?

+4
source share
1 answer

It turned out that the so-called “delete” operation does not actually delete events, but simply hides them and changes the status to “canceled”. Thus, events continue to exist on Google Calendar.
As a workaround, I retrieve deleted records using a parameter "showDeleted" = trueand then update them.

+4
source

Source: https://habr.com/ru/post/1568106/


All Articles