RoomKit
  • iOS : Objective-C
  • Android
  • macOS
  • Windows
  • Web
  • 小程序
  • Flutter
  • React Native
  • 产品简介
    • 概述
    • 发布日志
  • 开通 RoomKit 服务
  • 下载
  • 体验 App
  • 快速开始
  • 进阶功能
  • 客户端 API
  • 服务端 API
  • 常见错误码
  • 常见问题
  • 文档中心
  • RoomKit
  • 服务端 API
  • 教育云服务端 API
  • 创建房间

创建房间

更新时间:2022-06-17 19:25

1 描述

创建一个房间。

2 接口原型

  • 请求方法:POST

  • 请求地址:

    服务环境 调用频率限制 请求地址
    国内正式环境
    10 次/秒
    https://roomkit-edu-api.zego.im/room/create
  • 传输协议:HTTPS

3 请求参数

参数 类型 是否必选 示例 描述
secret_id
Int64
12580
创建企业时,ZEGO 分配的 secret ID。
access_token
String
"CIE7hNPK6Y55DeUJBSDrInP"
调用 获取服务器 AccessToken 接口返回的 access_token。
begin_timestamp
Int64
1590666065838
房间开始时间,时间戳,精确到毫秒(不能创建开始时间为一个小时前的房间)。
duration
Int
120
房间时长,以分钟为单位。
room_type
Int
1
房间类型:
  • 1:小房间模式
  • 3:1v1 房间模式
  • 5:大房间模式
  • 6:语音直播模式
此处选择的房间类型需要与 ProductID 对应的房间类型一致。
subject
String
"宣讲会"
房间主题。
pid
Int64
1
创建项目时,ZEGO 分配的 ProductID。
max_attendee_count
Int
10
最大进入人数。
host
Object
-
主持人(老师)。
host.uid
Int64
99900000
主持人(老师) uid。
attendees
Array of Object
-
参会人员(学生)数组。
attendees.uid
Int64
99900000
参会人员(学生) uid。
assistants
Array of Object
-
助教人员数组。
assistants.uid
Int64
99900000
助教人员 uid。
settings
Object
-
房间配置,一级结构,不传则内部所有变量都为 false。
settings.enable_host_cam
Bool
true
主持人默认开启摄像头,不传默认为 false。
settings.enable_host_mic
Bool
true
主持人默认开启麦克风,不传默认为 false。
settings.enable_attendee_cam
Bool
true
参会人员默认开启摄像头,不传默认为 false。
settings.enable_attendee_mic
Bool
true
参会人员默认开启麦克风,不传默认为 false。
settings.enable_chat
Bool
true
房间默认是否允许聊天,不传默认为 false。
settings.enable_raise_hand
Bool
true
房间默认是否允许举手,不传默认为 false。
settings.enable_attendee_share
Bool
true
房间默认是否允许分享,不传默认为 false。
settings.enable_attendee_draw
Bool
true
房间默认是否允许使用画笔,不传默认为 false。
settings.enable_wait
Bool
true
房间默认是否开启等候功能(仅会议场景允许开启等候),不传默认为 false。
settings.enable_wait_setting
Bool
true
房间是否允许开启等候功能(仅会议场景允许开启等候),不传默认为 false。
settings.is_auto_start
Bool
true
房间是否直接开始启动,不传默认为 false。如果为 false,则需要老师点击开始上课按钮开启课堂。
settings.max_onstage_count
Int
2
房间最大上台人数(仅大房间模式有效),不传默认为 2。
settings.is_private_room
Bool
true
是否是私有房间,即只允许受邀用户和企业管理人员加入房间,不传默认为 false。
password
String
"12!@#"
房间密码。

4 请求示例

以下是 create 接口的请求示例。

{
    "subject": "人生若只如初见创建的房间",
    "room_type": 5,
    "begin_timestamp": 1610436614000,
    "duration": 1433,
    "password": " ",
    "max_attendee_count": 1200,
    "pid": 1255,
    "settings": {
        "enable_host_cam": true,
        "enable_host_mic": true,
        "enable_attendee_cam": true,
        "enable_attendee_mic": true,
        "enable_chat": true,
        "enable_raise_hand": true,
        "enable_attendee_share": true,
        "enable_attendee_draw": true,
        "is_auto_start": true,
        "max_onstage_count": 2,
        "is_private_room": false
    },
    "host": {
        "uid": 100062263
    },
    "attendees": [
        {
            "uid": 100062263
        }
    ],
    "assistants": [
        {
            "uid": 100062164
        },
        {
            "uid": 100062167
        }
    ],
    "secret_id": 2587762184,
    "access_token": "kaVmfcZR5P8hpqqMmAWXCGYkxf2AgpQjo3NPfBg-mVHYfYUkukaXWN-wekbdVRDlYEp4mbvq9tonqDEw2nNsiw=="
}

5 响应参数

参数 类型 示例 描述
ret
Object
-
接口调用结果。
ret.code
Int
0
错误码。
ret.message
String
"succeed"
错误信息。
ret.version
String
"1.0.0"
版本号。
data
Object
-
接口调用返回数据。
data.room_id
String
"1200001356"
房间 ID,全局唯一,文档中出现的 room_id 都特指此字段。
data.room_number
String
"673153816"
房间 number,为了方便记忆定义的 9 位数房间号,非全局唯一。
data.begin_timestamp
Int64
1606184383000
房间开始时间。

6 响应示例

以下是 create 接口的响应示例。

{
    "ret": {
        "code": 0,
        "message": "succeed",
        "version": "1.0.0"
    },
    "data": {
        "room_id": "1200001356",
        "room_number": "673153816",
        "begin_timestamp": 1606184383000
    }
}
本篇目录