使用Google Calendar API创建事件时无法添加Google Meet链接的问题
使用Google Calendar API创建事件未生成Google Meet链接的问题
我调用https://www.googleapis.com/calendar/v3/calendars/primary/events接口创建谷歌日历事件,但新事件没有附带Google Meet链接,请求体和响应如下:
请求体
{ "calendarId": "primary", "conferenceDataVersion":1, "end": { "dateTime": "2022-08-12T06:00:00Z", "timeZone": "Asia/Kolkata" }, "start": { "dateTime": "2022-08-12T06:00:00Z", "timeZone": "Asia/Kolkata" }, "conferenceData": { "createRequest": { "conferenceSolutionKey": { "type": "hangoutsMeet" }, "requestId": "fgchvng5" }, "entryPoints": [ { "entryPointType": "video" } ] }, "summary": "titles are cool" }
响应结果
{ "kind": "calendar#event", "etag": "\"3320574101004000\"", "id": "d9f87ncse47u7ea7uam1n70bhc", "status": "confirmed", "htmlLink": "https://www.google.com/calendar/event?eid=ZDlmODduY3NlNDd1N2VhN3VhbTFuNzBiaGMgYWtoaWxlbTIwMTdAbQ", "created": "2022-08-12T06:50:50.000Z", "updated": "2022-08-12T06:50:50.502Z", "summary": "titles are cool", "creator": { "email": "testmail@gmail.com", "self": true }, "organizer": { "email": "testmail@gmail.com", "self": true }, "start": { "dateTime": "2022-08-12T06:00:00Z", "timeZone": "Asia/Kolkata" }, "end": { "dateTime": "2022-08-12T06:00:00Z", "timeZone": "Asia/Kolkata" }, "iCalUID": "d9f87ncse47u7ea7uam1n70bhc@google.com", "sequence": 0, "reminders": { "useDefault": true }, "eventType": "default" }
问题原因及修复方案
错误点分析
conferenceDataVersion参数位置错误:这个参数应该作为URL查询参数传递,而非请求体内容。API需要通过该参数识别你要处理会议数据,值必须设为1。- 多余的
entryPoints字段:使用createRequest自动生成Meet链接时,无需手动指定entryPoints,该字段会由API自动填充,手动添加会干扰会议创建流程。 - 事件起止时间一致:事件开始与结束时间完全相同,这种无效时间范围会导致API跳过会议链接的创建逻辑。
修正后的请求体
{ "end": { "dateTime": "2022-08-12T07:00:00Z", "timeZone": "Asia/Kolkata" }, "start": { "dateTime": "2022-08-12T06:00:00Z", "timeZone": "Asia/Kolkata" }, "conferenceData": { "createRequest": { "conferenceSolutionKey": { "type": "hangoutsMeet" }, "requestId": "fgchvng5" } }, "summary": "titles are cool" }
正确的请求URL
调用接口时,必须把conferenceDataVersion=1作为查询参数添加到URL末尾:
https://www.googleapis.com/calendar/v3/calendars/primary/events?conferenceDataVersion=1
完成以上修正后,再次调用API即可生成带Google Meet链接的日历事件。
内容的提问来源于stack exchange,提问作者akhil em
相关产品推荐
相关产品推荐

