我正在使用Google Calendar API作为我的一个项目。Google Calendar API - 导入活动:所有者必须是组织者或与会者
我想从我的应用程序将事件导入到Google日历,并将其锁定,以便最终用户无法在Google日历中修改它们。
的API的伟大工程,到目前为止,但是,当我尝试进口事件,我得到这个错误:
The owner of the calendar must either be the organizer or an attendee of an event that is imported.
即使我设定的组织者是日历的所有者之一。
下面是从API控制台POST样本:
POST https://www.googleapis.com/calendar/v3/calendars/_my_calendar_id%40group.calendar.google.com/events/import?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29.AHES6ZTdiWGywGp2LLSUlc8BV-dVIwJET5azIkNekjNgRjHRWc_Ojg
X-JavaScript-User-Agent: Google APIs Explorer
{
"end": {
"dateTime": "2013-01-02T16:22:00+00:00"
},
"iCalUID": "123456789",
"start": {
"dateTime": "2013-01-02T14:22:00+00:00"
},
"organizer": {
"email": "[email protected]",
"displayName": "Owner Guy"
},
"attendees": [
{
"email": "[email protected]"
}
]
}
重现步骤:
- 创建日历并获得ID或使用“主”您的主日历。
- 与某人分享,或让某人成为拥有者。
- 转到日历API参考/ events/import - >“试试吧!”,并在提交POST之前使用oAuth进行身份验证。
- 填写必填字段(开始,结束,icaluid等)
- 尝试将组织者或任何与会者设置为日历所有者之一。
日历ID你解决这个问题?你现在能够导入事件吗? –