Google calendar API move event

2.4k views Asked by At

Heres the deal,

On googles developer website they have at the bottom of each api function description a tool to try out the api, specifically I am using the calendar api (where it says " Use the APIs Explorer bellow to ...): https://developers.google.com/google-apps/calendar/v3/reference/events/get

This call returns an event when you enter a calendar ID and an eventID. After switching the little OAuth2.0 switch on and entering my calandarID and an event ID of mine it returns a nice 200 ok response with the event details.

Heres the problem: I go over to the move function in the calendar api: https://developers.google.com/google-apps/calendar/v3/reference/events/move

And fill in once again my calendar ID containing the event I want to move, the event ID (same as before) and the destination calendar ID (my other gmail account). but on executing this I get a red box with "the resource was not found" and the response is a 404.

Weird thing is I have been able to do this via the actual google calendar website by going into edit event -> drop down: calendar -> change owner, I get a box to fill in new calendar ID and it successfully went to my other gmail. Both calendars where not public when I tried via the GUI and are not public now when using the API. Preferably I want them to stay that way.

Any ideas why the api for moving a calendar event is not working for me?

2

There are 2 answers

2
SGC On BEST ANSWER

To move an event using events.move, you should have write access to both the calendars. I tried to move to different gmail account but it gave 404 error. But when I tried with moving to secondary calendar, it worked for me. developers.google.com/google-apps/calendar/concepts

0
Ryan On

I was getting a 404 error, and I assumed it was a credentials problem since that's what other people online wrote about.

Currently, when I browse the Google Calendar website for each of my calendars and visit Share This Calendar, I see the email address of my service account listed with credentials to "Make changes to events". That's on both the origin calendar and the destination calendar.

So I couldn't figure out how to set up my credentials differently.

It turned out not to be a problem with credentials at all.

I had been using the "eid" from the URL of the Google Calendar event webpage and assumed it was the Event ID. It's not.

When I use a valid Event ID, the "move" command worked as documented here.