如何使用Google Calendar API创建新的Google Meet [英] How to create a new google meet using google calendar api
问题描述
我需要实现一个javascript项目,该项目根据登录的用户创建一个新的Google Meet,并将事件添加到日历中并获取Google Meet的网址.如何在JS中使用Google Calendar API创建新的Google Meet.
I need implement a javascript project that creates a new google meet according to the user signed in and adds the event to the calendar and gets the url of the google meet. How can i create a new google meet using Google Calendar API in JS.
推荐答案
答案:
创建Calendar时,您需要使用Events资源的 conferenceData.createRequest
参数.Events:插入请求以将Meet链接添加到Calendar Event.
Answer:
You need to use the conferenceData.createRequest
parameter of the Events resource when creating a Calendar.Events: insert request to add a Meet link to a Calendar Event.
根据事件:插入和
conferenceDataVersion
:整数
API客户端支持的会议数据的版本号.版本0假定不支持会议数据,并且会忽略事件正文中的会议数据.版本1支持复制会议数据,以及使用ConferenceData的createRequest字段创建新会议.默认值为0.可接受的值为
0
到1
(包括两端).
conferenceData.createRequest
: 嵌套对象
生成新会议并将其附加到事件的请求.数据是异步生成的.要查看数据是否存在,请检查
status
字段.
conferenceSolution
和至少一个 entryPoint
或 createRequest
是必需的.
Either conferenceSolution
and at least one entryPoint
, or createRequest
is required.
conferenceData.createRequest.conferenceSolutionKey.type
: string
会议解决方案类型.
The conference solution type.
如果客户端遇到不熟悉或为空的类型,则它仍应能够显示入口点.但是,应该禁止修改.
If a client encounters an unfamiliar or empty type, it should still be able to display the entry points. However, it should disallow modifications.
可能的值为:
- "
eventHangout
"消费者环聊( http://hangouts.google.com ) - "
eventNamedHangout
"适用于G Suite用户的传统环聊( http://hangouts.google.com ) - "
hangoutsMeet
"适用于Google Meet( http://meet.google.com ) - "
addOn
"适用于3P会议提供商
- "
eventHangout
" for Hangouts for consumers (http://hangouts.google.com) - "
eventNamedHangout
" for classic Hangouts for G Suite users (http://hangouts.google.com) - "
hangoutsMeet
" for Google Meet (http://meet.google.com) - "
addOn
" for 3P conference providers
conferenceData.createRequest.requestId
: string
客户端为此请求生成的唯一ID.客户应为每个新请求重新生成此ID.如果提供的ID与上一个请求的ID相同,则该请求将被忽略.
The client-generated unique ID for this request. Clients should regenerate this ID for every new request. If an ID provided is the same as for the previous request, the request is ignored.
使用此信息,我们可以生成带有会议"链接的日历事件创建请求作为会议解决方案.
With this information we can generate a Calendar Event creation request with a Meet link as the conference solution.
gapi.client.calendar.events.insert({
"calendarId": "primary",
"conferenceDataVersion": 1,
"resource": {
"end": {
"date": "2020-10-24"
},
"start": {
"date": "2020-10-23"
},
"conferenceData": {
"createRequest": {
"conferenceSolutionKey": {
"type": "hangoutsMeet"
},
"requestId": "some-random-string"
}
},
"summary": "titles are cool"
}
});
注意::要生成会议链接,您 必须 设置 conferenceData.createRequest.requestId
来 任何随机字符串 .对于您要创建的每个新的见面链接,必须在请求中使用 不同的字符串 .
NB: In order for a Meet link to be generated, you must set conferenceData.createRequest.requestId
to any random string. For each new meet link you wish to create, you must use a different string in the request.
希望对您有帮助!
这篇关于如何使用Google Calendar API创建新的Google Meet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!