如何使用谷歌日历 api 创建一个新的谷歌会议 [英] How to create a new google meet using google calendar api

查看:63
本文介绍了如何使用谷歌日历 api 创建一个新的谷歌会议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现一个 javascript 项目,该项目根据登录的用户创建新的 google meet,并将事件添加到日历并获取 google meet 的 url.如何在 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.

推荐答案

答案:

您需要在创建日历时使用事件资源的 conferenceData.createRequest 参数.事件:插入请求以将 Meet 链接添加到日历事件.

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.可接受的值为 01(含).

Version number of conference data supported by the API client. Version 0 assumes no conference data support and ignores conference data in the event's body. Version 1 enables support for copying of ConferenceData as well as for creating new conferences using the createRequest field of conferenceData. The default is 0. Acceptable values are 0 to 1, inclusive.


conferenceData.createRequest: 嵌套对象

生成新会议并将其附加到事件的请求.数据是异步生成的.要查看数据是否存在,请检查 status 字段.

A request to generate a new conference and attach it to the event. The data is generated asynchronously. To see whether the data is present check the status field.

需要 conferenceSolution 和至少一个 entryPointcreateRequest.

Either conferenceSolution and at least one entryPoint, or createRequest is required.


conferenceData.createRequest.conferenceSolutionKey.type: string

会议解决方案类型.

如果客户端遇到不熟悉的或空的类型,它应该仍然能够显示入口点.但是,它应该禁止修改.

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" 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 与前一个请求相同,则该请求将被忽略.

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.

根据这些信息,我们可以生成一个带有 Meet 链接的日历活动创建请求作为会议解决方案.

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"
  }
});

注意:为了生成 Meet 链接,您必须设置 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.

这篇关于如何使用谷歌日历 api 创建一个新的谷歌会议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆