Register Users
The register interface is for the institution to register a ClassIn account on behalf of users. In API integration, it is an interface that cannot be skipped. Please make sure that the owner of the mobile phone number(or email address) has been informed and agreed on the operation.
The API call requires SID, safeKey, timeStamp, a valid mobile phone number(or email address) and a password. The valid mobile phone number is the account used to log in to ClassIn Client
. The password can either be plaintext or MD5 encrypted (MD5 encryption is recommended.). The nickname and avatar are optional. The User ID(UID) will be returned after a successful registration. The UID is the unique ID of the account and is used in subsequent API calls. Therefore, please store UIDs in your database.
Notes:
- The avatar is used to display in the ClassIn client.
- The nickname is used to display in the ClassIn client. Pass 1 or 2 in addToSchoolMember to synchronize the nickname to the student\teacher management page in the ClassIn management console.
Newly registered users are not displayed on the student/teacher management page in the management console by default. Here are two ways to bind users to your institution.
- Pass the parameter addToSchoolMember when calling this interface. 1: add as an institution student; 2: add as an institution teacher; other values do not add as institution members)
- Call add Student interface and add Teacher interface to bind the user to your institution as students or teachers.
- The
addToSchoolMember
parameter will always take effect, regardless of whether it is the first time registering or not.
If the above process of adding users to institutions is skipped, it will return errors when you schedule lessons for the users via API. (Error example: The user is not a teacher in your institution, etc.)
Please note that:
- If the mobile phone number or email is already registered as ClassIn account, when you call register-user interface, error code 135 will be returned, together with the UID.
- The nickname, avatar, and password will only take effect during the first registration.
URL
https://api.eeo.cn/partner/api/course.api.php?action=register
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 | The Unix Epoch timestamp should be within 20 minutes of the current API call time | UNIX Epoch timestamp is the number of seconds elapsed since 00:00:00 (world standard time) on January 1, 1970. |
telephone | Yes(Either pass telephone or email) | Format is:00 Country code-Mobile phone number. Notes: For mobile phone numbers in the Mainland China, do not input the country number, and the first number of phone number can't be 0. | Use mobile phone numbers to register | Example:For American mobile phone number, like 1 (800) 643-7676, please send 001-8006437676. For China Mainland mobile phone numbers, please send in the format of 13701237634. |
Yes(Either pass telephone or email) | Null | Null | ||
nickname | No | The maximum length is 24 characters. If it exceeds 24 characters, it will be automatically truncated to 24 characters | Nicknames and names | If this parameter is passed, it will be used as the nickname of the teacher or student and displayed on the client. If the nickname is not passed, the mobile phone number will be used as the nickname of the teacher or student. When the user logs in to the client, a window will pop up for the user to fill in the nickname. The nickname is displayed under the user's camera in the virtual classroom, with a maximum of 24 characters. |
password | Yes(Either password or md5pass) | Null | Clear-text passwords | The number of digits of the password shall not be less than 6 and not more than 20. If it does not meet the requirements, an error will be reported. |
md5pass | Yes(Either password or md5pass) | Null | MD5 encryption password | 32-bit MD5 encryption |
Filedata | No | Binary stream | The uploaded user's Avatar will be displayed on the ClassIn client. Without uploading the avatar, a pop-up window for selecting the avatar will pop up when the user logs in to the client. | File type:jpg,jpeg,gif,png Size:300*300 Less than 1 M |
addToSchoolMember | No | 0: Do not add the user to the institution; 1: Add to the institution as student; 2: Add to the insitution as teacher; Other values: Do not add the user to the institution. If not filled, the default value is 0. |
When addToSchoolMember is 1 or 2, the user will be displayed in student/teacher management page on ClassIn's management console. And the nicknames will be used in the student/teacher management page. | Whether add as a school member. |
Response Data
Key | Type | Sample Value | Meaning |
---|---|---|---|
data | number | Registers the returned user ID(this UID used in institutional subscription messages) | |
error_info | object | Return message object | |
└ errno | number | 1 | The error code |
└ error | string | "Normal execution" | Error details |
Sample
- HTTP Request
POST /partner/api/course.api.php?action=register HTTP/1.1
Host: root_url
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
SID=2339736&safeKey=3276433ab0216d9aec2621431cc12248&timeStamp=1494407873&telephone=001-8006437676&password=123456&Filedata=@~/photo.jpg
- Shell cURL analog request instruction
curl -H "Content-Type: application/x-www-form-urlencoded" -X "POST" \
-d "SID=1234567" \
-d "safeKey=0f7781b3033527a8cc2b1abbf45a5fd2" \
-d "timeStamp=1484719085" \
-d "telephone=001-8006437676" \
-d "password=123456" \
-d "Filedata=@D:\touxiang.jpg"\
"https://api.eeo.cn/partner/api/course.api.php?action=register"
Response Sample(The normal return json
packet example)
{
"data": 1001930,
"error_info": {
"errno": "1",
"error": "程序正常执行/Normal execution"
}
}
Error Code Instruction
Error Code | Instruction |
---|---|
1 | Successful execution. |
100 | Incomplete or incorrect parameters. |
102 | Don't have permissions(Security verification failed). |
114 | Server exception. |
131 | Registration failure. |
134 | Illegal mobile phone number. |
135 | The mobile phone number has been registered(UID will be returned at the same time). |
137 | Illegal password length(6-20 digits). |
224 | Type of picture uploaded is wrong. |
288 | The mobile phone number segment is invalid. |
340 | Registration succeeded, user avatar setting failed. |
341 | Uploaded picture size error (300 * 300). |
342 | Uploaded picture exceeded the limit (1M). |
461 | The email has been registered ( UID will be returned at the same time). |
820 | The registration was successful, but failed to add as an institution student. |
821 | The registration was successful, but failed to add as an institution teacher. |
845 | Exceeded the maximum number of enabled teachers in the institution. |