Google Calendar Event Update Issue

In one of my projects, I was working on Google calendar, the tasks included creating an event, updating an existing event, deleting event etc.

I did not face any problem while  creating and deleting an event, but while trying to update an event it gave me an error ‘Bad request/Invalid data’. After a long try I got to know that Google creates a sequence number for each events. And it should be increased by one on every update. So here, I was making the mistake of not sending the sequence number with the update data.

While retrieving event details, you can get the current sequence from the response like below:

sequence = event.sequence
And while updating the event, pass the sequence increased by 1 with other data like shown below:

editEvent = {
             start:{ dateTime: .....},
             end:{ dateTime: .....},
             summary: .......,
             location: .......,
             attendees: ........,
             sequence: sequence + 1,
                };
150 150 Burnignorance | Where Minds Meet And Sparks Fly!