本文介绍了删除后创建相同的事件导致409错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个应用程序,使用API将服务器中的活动添加到用户的Google日历中。
我在这种情况下遇到了一个 HTTP 409 Conflict 错误:
- 明确定义ID /
- 删除活动/
- 尝试使用相同的ID创建事件 - 获取错误。
事实上,在调用 delete
API方法之后。
是否有解决此问题的解决方法?
- Create an event with some explicitly defined ID / Events: insert
- Delete the event / Events: delete
- Try to create event with the same ID - get the error.
This scenario can come true when:
- a user exports events from our server.
- one of the events (say with ID = 1) will be disabled on our server
- the user exports again the events - this disabled event will removed from user's Google Calendar / API call: delete, eventId = 1
- the disabled event will be enabled again
- 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?
解决方案
It turned out that so-called "delete" operation in fact doesn't delete events, but just hides them and changes their status to "cancelled". So the events continue to exist in Google Calendar.
As workaround I retrieve deleted entries using "showDeleted" = true
option and then update them.
这篇关于删除后创建相同的事件导致409错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!