0
이 문제와 관련된 다른 게시물을 확인했지만 동일하지 않습니다. "응답"을 사용하고 있으며 Google API 웹 사이트에서 날짜/시간을 복사하여 형식이 올바른, 나는 헤더와 함께 놀았어요. 왜 이것이 작동하지 않는 다른 아이디어?삽입 캘린더 용 Google 캘린더 이벤트 API
나는 다음과 같은 오류를 받고 있어요 :
Error: failed [400] { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Missing end time." } ], "code": 400, "message": "Missing end time." } } [object Object]
다음 단계로 나눌 내 코드 : 내가 POST에 갈거야 URL을 사용자 액세스 토큰, 헤더를 포함한 삽입 된 일정 이벤트에 대한 옵션 과 시작, 종료 및 이벤트 요약, 실제 HTTP 게시 및 콜백 기능과 이벤트 :
calendarSchedule() {
if(Meteor.user() && moment(Meteor.user().services.google.expiresAt) > moment()._d) {
var url = "https://www.googleapis.com/calendar/v3/calendars/primary/events";
var userAccessToken = Meteor.user().services.google.accessToken;
var options = {
headers : {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + userAccessToken,
'X-JavaScript-User-Agent': "Google APIs Explorer",
},
calendarId: 'primary',
resource : {
start: { dateTime: "2016-05-03T18:03:58+02:00" },
end: { dateTime: "2016-05-03T18:03:58+02:00" },
summary: "testSummar",
}
};
HTTP.post(url, options,
function(error,result) {
console.log("posted to calendar? "+ error+ result);
});
}
}