删除后创建相同的事件导致409错误 [英] Creating the same event after removing causes 409 error

查看:106
本文介绍了删除后创建相同的事件导致409错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,使用API​​将服务器中的活动添加到用户的Google日历中。
我在这种情况下遇到了一个 HTTP 409 Conflict 错误:


  1. 明确定义ID / 活动:插入

  2. 删除活动/
  3. 尝试使用相同的ID创建事件 - 获取错误。

这种情况可以在以下情况下实现:


  1. 用户从我们的服务器导出事件。我们的服务器上将禁用事件(比如ID = 1)

  2. 用户再次导出事件 - 此用户的Google Calendar / API调用将禁用该事件:delete ,eventId = 1

  3. 禁用的事件将再次启用

  4. 用户执行导出 - API插入请求将为fir编辑相同的ID = 1。并且会提出错误409。 / API调用:insert,eventId = 1

事实上,在调用 delete API方法之后。
是否有解决此问题的解决方法?

事实证明,所谓的删除操作实际上并不会删除事件,而只是隐藏它们并进行更改他们的状态为取消。因此,这些事件在Google日历中仍然存在。

解决方法是使用showDeleted= true 选项检索已删除的条目,然后更新它们。 p>

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?

解决方案

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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆