Create Classroom
This interface is used to create a classroom activity under a unit.
Note:
- This interface only supports the creation of standard classrooms and does not support the creation of dual-teacher sub-classerooms.
- The parameters of
screenMode
(screen mode) andteachMode
(teaching mode) are not needed. They are assigned appropriate values based on the value ofcameraHide
(whether to hide the seat area).- If
cameraHide=0
(seat area shown), thenteachMode=1
(online classroom) andscreenMode=1
(standard mode). - If
cameraHide=1
(seat area hidden), thenteachMode=2
(smart classroom), andscreenMode=2
(large-screen mode).
- If
- This interface does not support selecting the participants of the classroom activity; the default setting is to
Publish to all members
. - This interface only supports the creation of published classrooms and does not support drafts.
- If cloud recording is enabled but web live streaming is not activated, the
data
will return the classroom web-live player addresslive_url
, while the pulling stream addresslive_info
will be empty. - If both cloud recording and web live streaming are enabled, three pulling stream addresses (RTMP, HLS, FLV) will be generated and bound to the classroom. The
data
will return the classroom web-live player addresslive_url
and the pulling stream addresseslive_info
. If the web-live streaming is later canceled, the three pulling stream addresses will still exist and remain bound to the classroom. - If the classroom does not enable cloud recording, both the web-live player address
live_url
and the pulling stream addresseslive_info
in thedata
will be empty. recordType
,recordState
,liveState
, andopenState
constitute a complete set of parameters and cannot be partially passed; otherwise, an error will occur.
URL
https://root_url/lms/activity/createClass
HTTP Request Methods
- POST
coding Format
- UTF-8
Request Data
Header Parameters
Key | Required | Type | Description |
---|---|---|---|
X-EEO-SIGN | Yes | string | Signature; see the rules here |
X-EEO-UID | Yes | string | Institution's SID |
X-EEO-TS | Yes | string | Timestamp |
Body Parameters
Key | Required | Type | Description | Rules Description |
---|---|---|---|---|
courseId | Yes | integer | Class(course) ID | |
unitId | Yes | integer | Unit ID | |
name | Yes | string | Classroom activity name | Length must not exceed 50 characters |
teacherUid | Yes | integer | UID of the instructor | |
startTime | Yes | integer | Start time of the classroom activity | Must be a Unix Epoch timestamp (in seconds) within the next 2 years |
endTime | Yes | integer | End time of the classroom activity | Unix Epoch timestamp (in seconds) |
assistantUids | No | array[integer] | List of co-teacher UIDs | Example: [1000082,1000083]. There are no co-teachers by default if this parameter is not passed; UID values are returned from the user registration API |
cameraHide | No | integer | Whether to hide the seating area | 0 = No (show seating area), 1 = Yes (hide seating area). Defaults to 0; if not provided, the default value is used; if provided incorrectly, it reports parameter error ; when cameraHide = 1, isAutoOnstage will always be set to 0 (i.e., the value of isAutoOnstage will be ignored) |
isAutoOnstage | No | integer | Whether students automatically go on stage when entering the classroom | 0 = No, 1 = Yes. Defaults to 1; if not provided, the default value is used; if provided incorrectly, it reports parameter error . |
seatNum | No | integer | Number of people on stage | Includes the teacher; for example, passing 1 means 1v0 (only the teacher's camera is displayed). Defaults to 7 (1v6); if not provided, the default value is used. If the maximum number of students on stage configured by the organization is less than 1v6, it defaults to the organization's maximum number of students on stage. Passing a number less than the configured maximum will be executed normally; passing a number greater than the configured maximum will reset to the maximum number of students allowed. |
isHd | No | integer | Whether HD is enabled | 0 = Non-HD, 1 = HD, 2 = Full HD. Defaults to 0; if not provided, the default value is used; if provided incorrectly, it reports parameter error . Currently, only supports HD or Full HD for 1v1 or 1v6. |
isDc | No | integer | In dual-camera mode, whether to enable the secondary camera | 0 = Not enabled, 3 = Enable full HD secondary camera. Defaults to 0; if not provided, the default value is used; if provided incorrectly, it reports parameter error ; if isDc equals 3, and the number of students on stage is not 1v1 (i.e., seatNum is not equal to 2), it will return this setting does not support dual-camera ; if isDc equals 3 and seatNum equals 2, then isHd will be set to 2 (i.e., the API will ignore the value of isHd ). |
recordType | No | integer | Type of cloud recording | 0 = Record classroom, 1 = Record the teacher camera, 2 = Record both. Defaults to 0; if not provided, the default value is used; if provided incorrectly, it reports parameter error . |
recordState | No | integer | Whether to enable cloud recording | 0 = Not recording (off), 1 = Recording (on). Defaults to 0; if not provided, the default value is used; if provided incorrectly, it reports parameter error . When recording is enabled, ClassIn will record the classroom, which can be used for web live streaming or replay. If web live streaming or replay is required, recording must be enabled; otherwise, web live streaming or replay cannot be started. |
liveState | No | integer | Whether to enable web live streaming | 0 = Not web live (off), 1 = Web live (on). Defaults to 0; if not provided, the default value is used; if provided incorrectly, it reports parameter error . If web live streaming is required, recording must be enabled. |
openState | No | integer | Whether to enable the web replay | 0 = Not public (off), 1 = Public (on). Defaults to 0; if not provided, the default value is used; if provided incorrectly, it reports parameter error . If web replay is required, recording must be enabled. |
isAllowCheck | No | integer | Whether to allow viewing each other's learning reports and scores | 0 = Not allowed, 1 = Allowed. Defaults to 1; if not provided, the default value is used; if provided incorrectly, it reports parameter error . |
Response Data
Key | Type | Sample Value | Description |
---|---|---|---|
code | integer | 1 | Error code |
msg | string | "Execution successful" | Error message |
data | object | Response object | |
└ activityId | integer | 25096094 | Activity ID |
└ classId | integer | 1141162 | Classroom ID |
└ name | string | "API Created Classroom" | Classroom name |
└ live_info | object | Three pulling stream addresses | |
└ RTMP | string | RTMP protocol pulling stream address | |
└ HLS | string | HLS protocol pulling stream address | |
└ FLV | string | FLV protocol pulling stream address | |
└ live_url | string | Classroom web live/replay page |
Sample
- HTTP request
POST /lms/activity/createClass HTTP/1.1
Host: root_url
X-EEO-SIGN: 5cb85cc272274a4353a9dc4c8dcdf0fc
X-EEO-UID: 409864
X-EEO-TS: 1722938160
Content-Type: application/json
Content-Length: 274
{
"courseId": 414193,
"unitId": 26020897,
"name": "API Created Classroom",
"teacherUid": 409864,
"startTime": 1723010760,
"endTime": 1723016760,
"liveState": 1,
"openState": 1,
"recordState": 1,
"recordType": 0
}
- Shell cURL analog request instruction
curl -X POST \
-H 'Host: root_url' \
-H 'X-EEO-SIGN: 5cb85cc272274a4353a9dc4c8dcdf0fc' \
-H 'X-EEO-UID: 409864' \
-H 'X-EEO-TS: 1722938160' \
-H 'Content-Type: application/json' \
-d '{"courseId": 414193, "unitId": 26020897, "name": "API Created Classroom", "teacherUid": 409864, "startTime": 1723010760, "endTime": 1723016760, "liveState": 1, "openState": 1, "recordState": 1, "recordType": 0}' \
'https://root_url/lms/activity/createClass'
Response Sample(The normal return json packet example)
{
"code": 1,
"msg": "Execution successful",
"data": {
"activityId": 25107347,
"classId": 1152680,
"live_info": {
"RTMP": "rtmp://liveplay.eeo.cn/eeolive/576f5a8c97de-18329123b10cec7d2?txSecret=c10b423a82cab861860081c02d03d87b&txTime=7d8d37cd",
"HLS": "https://liveplay.eeo.cn/eeolive/576f5a8c97de-18329123b10cec7d2.m3u8?txSecret=c10b423a82cab861860081c02d03d87b&txTime=7d8d37cd",
"FLV": "https://liveplay.eeo.cn/eeolive/576f5a8c97de-18329123b10cec7d2.flv?txSecret=c10b423a82cab861860081c02d03d87b&txTime=7d8d37cd"
},
"live_url": "https://www.eeo.cn/live.php?lessonKey=3dca7b0e14e3bb35",
"name": "api-0829"
}
}
Error Code Descriptions
Error Code | Description |
---|---|
100 | Incomplete or incorrect classroom parameters |
104 | Server call failed |
119 | End time must be greater than start time |
120 | Invalid start time |
136 | No such teacher in the organization; please add the teacher to the organization |
147 | No information for this class |
158 | Failed to add students to the classroom |
160 | No such cloud directory under the organization |
161 | Single classroom creation failed |
165 | The duration of a classroom activity must be at least 15 minutes and cannot exceed 24 hours |
172 | Class students cannot be added as teachers |
173 | Class auditors cannot be added as teachers |
219 | Teacher information does not exist |
220 | Failed to add classroom activity |
221 | Failed to modify settings for web-live and playback |
267 | Classroom activity created successfully, but web live streaming setting failed |
268 | Classroom activity start time exceeds the allowed range |
318 | Co-teacher is not a teacher from this organization |
319 | Class students cannot be added as co-teachers |
320 | Class auditors cannot be added as co-teachers |
322 | The instructor of the classroom activity cannot be added as co-teachers |
324 | Failed to add co-teacher to the teacher list |
325 | Transfer students cannot be added as teachers |
326 | Failed to add co-teacher to the teacher list |
387 | Teacher has been disabled |
388 | Co-teacher has been disabled |
390 | Maximum number of classroom activities under this class has been reached |
451 | Failed to add cover and description, length exceeds limit |
454 | Classroom activity start and end time overlap with system maintenance time |
769 | Teacher version or teacher trial version; head teacher is not the same person |
800 | Teacher is in the process of being disabled |
804 | Co-teacher is in the process of being disabled |
884 | Teacher account has been canceled |
885 | Co-teacher account has been canceled |
21304 | The institution does not support setting subjects |
21317 | Number of co-teachers exceeds limit |
21319 | Teacher has been deleted |
101001001 | Parameter error |
101002005 | Signature exception |
101002006 | Timestamp expired |
101002008 | Timestamp does not exist |
110100066 | This setting does not support dual-camera mode |
121601003 | You have reached the monthly limit for creating classroom activities; upgrade your account for more benefits |
121601004 | You have reached the monthly limit for creating classeroom activities; cannot create more classroom activities |
121601020 | Business parameter error |
121601021 | Class does not belong to the current organization |
121601022 | It is not a standard class |
121601023 | This class has been dissolved and cannot be operated |
121601030 | Missing required parameters |