1
votes

I'm using https://github.com/google/google-api-ruby-client to connect to different google API in particular the Google Calendar one.

Creating an event, updating it and deleting it works most of the time with what one can usually find around.

The issue appears when one tries to update an event details after a previous update of the dates of the event. In that case, the id provided is not enough and the request fails with an error :

SmhwCalendar::GoogleServiceException: Invalid sequence value. 400

Yet the documentation does not mention such things : https://developers.google.com/google-apps/calendar/v3/reference/calendars/update

The event documentation does describe the sequence attribute without saying much : https://developers.google.com/google-apps/calendar/v3/reference/events/update

  1. What's needed to update an event ?
  2. Is there specific attributes to keep track of when creating, updating events besides the event id ?
  3. how is the ruby google api client handling those ?
2

2 Answers

0
votes

I think my answer from Cannot Decrease the Sequence Number of an Event applies here too. Sequence number must not decrease (and if you don't supply it, it's the same as if you supplied 0) + some operations (such as time changes) will bump the sequence number. Make sure to always work on the most recent copy of the event (the one that was provided in the response).

0
votes

@luc answer is pretty correct yet here are some details.

Google API documentation is unclear about this (https://developers.google.com/google-apps/calendar/v3/reference/events/update).

You should consider that the first response contains a sequence number of 0. The first update should contain that sequence number (alongside the title, and description etc ). The response to that request will contain an increment sequence number (1 in this case) that you should store and reuse on the next update.

While the first update would imply a sequence number of 0 (and work) if you don't pass any the second might still pass but the third will probably not (because it's expecting 1 as sequence).

So that attribute might appear optional but it is actually not at all optional.