2012-06-15 2 views
3

자바 용 google-api-services-calendar v3을 사용합니다.google 캘린더 API v3에 새 캘린더 항목을 삽입하면 404가 반환됩니다.

문제없이 내 캘린더 항목을 나열합니다. 그러나 새 CalendarEntry 삽입이 실패합니다.

CalendarListEntry newCal = new CalendarListEntry(); 
newCal.setId(calTitle); 
newCal.setSummary(calTitle); 
newCal.setTimeZone("Europe/Paris"); 
CalendarListEntry execute = null; 
try { 
    execute = service.calendarList().insert(newCal).execute(); 
} catch (IOException e) { 
    e.printStackTrace(); 
} 

이 달력이 생성되지 않습니다

나는 샘플과 같은 코드를 사용합니다. 로그에 내가 가지고있는 것 :

CONFIG: {"id":"A_TEST","summary":"A_TEST","timeZone":"Europe/Paris"} 
15 juin 2012 16:20:45 com.google.api.client.http.HttpRequest execute 
CONFIG: -------------- REQUEST -------------- 
POST https://www.googleapis.com/calendar/v3/users/me/calendarList 
Accept-Encoding: gzip 
Authorization: <Not Logged> 
User-Agent: Google-HTTP-Java-Client/1.10.2-beta (gzip) 
Content-Type: application/json; charset=UTF-8 
Content-Encoding: gzip 
Content-Length: 69 

CONFIG: Total: 60 bytes 
CONFIG: {"id":"A_TEST","summary":"A_TEST","timeZone":"Europe/Paris"} 
15 juin 2012 16:20:46 com.google.api.client.http.HttpResponse <init> 
CONFIG: -------------- RESPONSE -------------- 
HTTP/1.1 404 Not Found 
X-Frame-Options: SAMEORIGIN 
Date: Fri, 15 Jun 2012 14:07:52 GMT 
Content-Length: 120 
Expires: Fri, 15 Jun 2012 14:07:52 GMT 
X-XSS-Protection: 1; mode=block 
Content-Encoding: gzip 
Content-Type: application/json; charset=UTF-8 
Server: GSE 
Cache-Control: private, max-age=0 
X-Content-Type-Options: nosniff 

CONFIG: Total: 165 bytes 
CONFIG: { 
"error": { 
    "errors": [ 
    { 
    "domain": "global", 
    "reason": "notFound", 
    "message": "Not Found" 
    } 
    ], 
    "code": 404, 
    "message": "Not Found" 
} 
} 

아이디어가 있으십니까?

+0

HII는 유 PLZ u는 다음 PLZ 줘요 구글의 샘플 코드를 보내 몇 가지 코드를 모를 거요 날 믿어요 절대 모를 겁니다 캔트 내가 구글 캘린더에서 이벤트를 삽입 할 수있는 방법을 말해 줄 수 api 그러나 이것을 이해할 수 없습니다. – Google

답변

3

RTFM!

나는 좋은 uri에 없었다. 올바른 삽입은 https://www.googleapis.com/calendar/v3/calendars

이 아니고 https://www.googleapis.com/calendar/v3/users/me/calendarList이 아니어야합니다.

코드는 다음과 같습니다?

Calendar newCal = new Calendar(); 
    newCal.setSummary(calTitle); 
    newCal.setTimeZone("Europe/Paris"); 

    Calendar createdCalendar = null; 
    try { 
     createdCalendar = service.calendars().insert(newCal).execute(); 
    } catch (Exception e){ 
     e.printStackTrace(); 
    } 
+0

이 URL 스위치는 최신 Python API를 사용하여 나를 고쳤습니다. 잘못된 URL이 광고되는 이유는 무엇입니까? 앞서 언급 한 "매뉴얼"에 대한 언급이 있습니까? – Attie