我試圖使用Google日曆API v3創建日曆,如果它尚不存在。我的實現成功檢索我的所有日歷和事件,並可以更改日曆,但我很努力添加新的日曆。這是我爲了嘗試添加一個新的日曆爲用戶做到:使用c#.net創建Google日曆Api v3的日曆時出現404錯誤
...
var calendarService = new CalendarService(_authenticator);
var calendarId = "com.somedomain.somename.1234"; // Some random ID
try {
calendarManager.GetCalendar(calendarId); // No calandar found
} catch(GoogleCalandarServiceProxyException e){
// Ok, so far so good, calendar not found (that is correct) and I am here
var someCalendar = new Google.Apis.Calendar.v3.Data.CalendarListEntry {
Summary = "Some summary!",
Description = "A calendar descr.",
AccessRole = "writer",
BackgroundColor = "#E7323C",
Id = calendarId
};
calendarService.CalendarList.Insert(someCalendar).Fetch(); // Fetch to execute
}
請求生成:
insert @ https://www.googleapis.com/calendar/v3/users/me/calendarList?alt=json&prettyPrint=true
RequestError:
Google.Apis.Request.RequestErrorNotFound[404]Errors [Message[Not Found]Location[-] Reason[notFound] Domain[global]]]
奇怪的事情是在做一個GET在https://www.googleapis.com/calendar/v3/users/me/calendarList?alt=json&prettyPrint=true不返回東西,所以它應該在那裏。
我希望有一些很棒的人/女孩在那裏知道該怎麼做!我完全被卡住了。
更新 好像我收到的CalendarList谷歌阿比瀏覽器也是同樣的404錯誤:
地址: https://developers.google.com/google-apps/calendar/v3/reference/calendarList/insert
請求:
POST https://www.googleapis.com/calendar/v3/users/me/calendarList?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29.AHES6ZQTj-D6uIMOWr_AoFYVvfefsEGcVvLvvMf4aKhgrdvQE25aVw
X-JavaScript-User-Agent: Google APIs Explorer
{
"id": "hastalavista"
}
迴應:
404 Not Found
- Show headers - { "error": { "errors": [ {
"domain": "global",
"reason": "notFound",
"message": "Not Found" } ], "code": 404, "message": "Not Found" } }
有誰知道Google是否已更改此資源的URL?如果是,我如何更改Google Calendar Api v3以使用更新後的url ...?