Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Calendar API event insert always return 404 "not found" error

Tags:

I tried the calendar insert example from here : https://developers.google.com/google-apps/calendar/v3/reference/events/insert#examples No matter which property i use, i always get the 404 "not found" error. Anyone can shed some light on this? Many thanks!!!

POST https://www.googleapis.com/calendar/v3/calendars/test/events?sendNotifications=false&fields=start&key={YOUR_API_KEY}  Content-Type:  application/json Authorization:  Bearer ya29.AHES6ZQaT3-Tj_bviwaY9Xi3gDspuBbCtEKtidnZkTXuWpI X-JavaScript-User-Agent:  Google APIs Explorer  {  "end": {   "date": "2012-07-11"  },  "start": {   "date": "2012-07-09"  } } 

response: 404 Not Found

{  "error": {   "errors": [    {     "domain": "global",     "reason": "notFound",     "message": "Not Found"    }   ],   "code": 404,   "message": "Not Found"  } } 
like image 409
Jianping Huang Avatar asked Jul 02 '12 21:07

Jianping Huang


People also ask

Why can't I add an event to my Google Calendar?

Error: 403 Forbidden when adding eventsThis usually indicates you do not have permissions to edit or add events to the calendar you picked. To fix this, ask the calendar owner to give you editing privileges on Google Calendar, and then reconnect your Google Calendar account in Zapier.

Why can't I add an event to a shared Google Calendar?

If you're not able to add an event, it's likely that you don't have editing permissions for that calendar. You can either request edit permission from whoever made the calendar, or create a new shared calendar and share that with all the involved people.

How do I enable Google Calendar API in Google API console?

Enable API accessIn the API Manager pane, click Library to see the list of available APIs. In the Google Apps APIs list, scroll down to click or search for Calendar API, then on the API page, click Enable.

How do I use Google Calendar API in HTML?

On the left side of the screen, click the name of the calendar you want to embed. In the "Integrate calendar" section, copy the iframe code displayed. Under the embed code, click Customize. Choose your options, then copy the HTML code displayed.


2 Answers

I believe it's telling you that the calendar "test" resource cannot be found. Have you created a calendar called "test"? If you replace "test" with "primary" (your main calendar) then the Explorer should work.

like image 88
Matt Healy Avatar answered Sep 21 '22 13:09

Matt Healy


To JuanPablo, Re non-primary calendar:

In case of non-primary calendar you have to use the id (in form of an email address) as the calendarId.

Example: Let's say you have a calendar named 'test'. You get its id like this

GET https://www.googleapis.com/calendar/v3/users/me/calendarList?key={YOUR_API_KEY} -> {  "kind": "calendar#calendarList", ...  "items": [   {     "kind": "calendar#calendarListEntry",    "etag": ...,    "id": "[email protected]",    "summary": "test",    "description": "Testing calendar for development of Calendar related applications", ...    }   }  ] } 

Your POST will then look like this

POST https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?sendNotifications=false&fields=start&key={YOUR_API_KEY} 
like image 33
Tomy Avatar answered Sep 22 '22 13:09

Tomy