Create course
To create a course, you need to pass the parameter of SID, safeKey, timeStamp, course name, folder ID, course cover picture (binary stream), expiration time, course description, classroom setting ID (mainly used to set classroom skin and other options), a course unique ID, headteacher UID, etc. SID, safeKey, timeStamp, and the course name are required. The call returns the course ID and instructions for you to refer to. If you pass the course unique ID, the interface will verify whether the unique ID already exists. If so, it returns the course ID previously created; if not, a new course will be created.
When you create a new course, an IM chat will be created in the ClassIn app automatically. The user's nickname is set as his/her course nickname in the course group chat by default. If you want to synchronize the user name in the School Dashboard to the IM grout chat, please call Modify group member nickname to edit.
Notes:
- You can set a headteacher, also named Course Advisor/Main Teacher in the School Dashboard, when creating the course. The headteacher can edit the course in the ClassIn app, such as create/edit/delete lessons and course students in the IM group. The operation in the ClassIn app by headteachers will not be synchronized to your school's system. For example, the headteacher created a new lesson in the IM group. The data of the newly added lesson will not be synchronized to your system.
- If you pass an empty value in the parameter of mainTeacherUid, it means you did not pass a value for the headteacher, then you did not set a headteacher for the course.
URL
https://api.eeo.cn/partner/api/course.api.php?action=addCourse
HTTP Request Methods
- POST
Coding format
- UTF-8
Request data
Key | Required | More Restrictions | Instructions | Description |
---|---|---|---|---|
SID | Yes | Null | School ID | It is available through the eeo.cn application |
safeKey | Yes | Fixed 32-bit all lowercase characters | School authentication security key | safeKey=MD5(SECRET+timeStamp) |
timeStamp | Yes | Null | Timestamp used by safeKey | Unix Epoch timeStamp is the number of seconds passed by 00:00 (world standard time) on January 1, 1970 |
courseName | Yes | Null | coursename | Null |
folderId | No | Do not pass the default empty directory | Available resource folder ID | Null |
Filedata | No | Binary stream | The cover of the course | Null |
expiryTime | No | If the expiration time is not passed, pass 0 and pass 0 are all regarded as 0, and the expiration time of the course is set to never expire.If an expiry date is set, the expiry date can only be passed within 5 years of the current time | Expiration time | Unix Epoch timeStamp The expiration time will be extended to 3 monthes later when a new class is created and the exporate time is within 3 monthes. |
courseIntroduce | No | Course introduction (Can be null),The length of the 0 ~ 400 words | Null | Null |
classroomSettingId | No | Default is 0 | Classroom setting ID | Classroom setting ID search method: log into the background of eeo.cn, find the institutional setting and classroom setting, and the classroom setting ID will be displayed for each set of classroom Settings;After selecting this set of Settings, all classrooms under the course will be displayed according to this setting. Classroom Settings include: a. classroom skin, b. switch Settings (toolbar below the head, chat window, student-side roster, after-class evaluation, classroom toolbox, cloud disk, etc.), c. parameter Settings (class countdown, classroom chat interval, etc.) |
courseUniqueIdentity | No | For example: 45s8d5a6asaa1ssf (1-32 bit characters, non-conforming value interface will return 100 errors) | A unique identifier | The organization can pass a unique identity, and once this value is passed in, we verify that it is present in the created course |
mainTeacherUid | No | No headteacher when not passing this parameter or passing empty value. | Headteacher's UID. | registers the user UID returned by the user interface |
subjectId | No | Not passing any value or passing values that do not comply with the rule is determined as 0. This parameter is only valid for courses created in the School Dashboard for primary and secondary schools. | course subject | 1: Chinese; 2: Maths; 3: English; 4: Physics; 5: Chemistry; 6: Biology; 7: Politics; 8: History; 9: Geography; 10: Ideological and Moral Education; 11: Music; 12: PE; 13: Arts; 14: General Technology; 15: IT; 16: Science; 99: Others |
allowAddFriend | No | tinyint,Maximum length 1 | Null | Whether to allow class members to add friends to each other in the course group,0=do not allow,1=allow return error if values passed are not 0 or 1 If the field is not passed, would use the default setting in the admin dashboard. ( The default state setting that allows class members to add friends to each other . Path:log in ClassIn admin dashboard -- Setting -- Class Setting) |
allowStudentModifyNickname | No | tinyint,maximum length 1 | Null | Whether students are allowed to modify their class nicknames in the course group,0=not allow,1=allow. It reports parameter error when passing values not 0 or 1. If the field is not passed, would be set to 0 by default. |
notAllowDeleteCourseStudentReplay | No | int | If this parameter is not passed, the setting will not be modified; if passed incorrectly, it will report as parameter error |
Whether to disallow students who have left the course from viewing the course content or to prevent students from accessing the course content after the course is dismissed. 0=No(allow), 1=Yes(disallow) |
Response data
Key | Type | Sample value | Meaning |
---|---|---|---|
data | number | 352861 | Create success returned course ID |
error_info | object | Return message object | |
└ errno | number | 1 | Error code |
└ error | string | "Program normal execution" | Error list |
Sample
- HTTP request
POST /partner/api/course.api.php?action=addCourse HTTP/1.1
Host: www.eeo.cn
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
SID=2339736&safeKey=f834fff59eb3bc8a2ff26a3cb59155f0&timeStamp=1492792399&courseName=Good+Day&folderId=22419&Filedata=@~/photo.jpg&expiryTime=1492795000&mainTeacherUid=1001001&courseIntroduce=ClassIn,真正专业的在线教室&classroomSettingId=235&courseUniqueIdentity=532512
- Shell cURL analog request instruction
curl -X "POST" \
-d "SID=1234567" \
-d "safeKey=0f7781b3033527a8cc2b1abbf45a5fd2" \
-d "timeStamp=1484719085" \
-d "courseName=Good Day" \
-d "folderId=22419" \
-d "Filedata=@~/photo.jpg" \
-d "expiryTime=1523428688" \
-d "mainTeacherUid=1001001" \
-d "courseIntroduce=ClassIn,真正专业的在线教室" \
-d "classroomSettingId=235" \
-d "courseUniqueIdentity=24545" \
"https://api.eeo.cn/partner/api/course.api.php?action=addCourse"
Response sample(The normal return json
packet example)
{
"data": 352861,
"error_info": {
"errno": 1,
"error": "程序正常执行"
}
}
Error Code Description
Error code | Description |
---|---|
1 | Successful execution. |
100 | Incomplete or incorrect parameters. |
102 | No permissions(Security verification failed). |
103 | Failed to upload file to server. |
104 | Operation failure(unknown error). |
114 | Server exception. |
151 | The expiration time should be at least one day later. |
154 | The expiration time should be within 5 years. |
160 | The institution does not have the directory/folder in its cloud disk. |
260 | Failed to add a course advisor(mainTeacher). |
331 | The format of the course advisor's account is incorrect . |
334 | Course advisor does not exist. |
371 | The classroom setting does not exist. |
373 | The classroom setting does not belong to the institution. |
389 | The course advisor has been deactivated. |
398 | The data already exists (The courseUniqueIdentity already exists.). |
400 | The requested data is not valid. |
460 | The course or class(lesson) is being created by another request.The same courseUniqueIdentity is used to create course/class(lesson) at the same time(within 1 second). |
805 | The course advisor is stopped using. |
883 | The course advisor's account has been cancelled. |