Register Users(Multiple)
You can register up to 10 users at a time. The API call requires SID, safeKey, timeStamp and valid phone numbers or email addresses used as the account to log into the 'ClassIn client'. The Nicknames are optional. The passwords can be plaintext or MD5 encryption (MD5 encryption is recommended). 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:
- This interface does not support passing users' avatars. Please call the Edit User Info to modify the individual user's avatar information.
- The nickname is used to display on the ClassIn client. When you pass 1 or 2 in the field of addToSchoolMember and the mobile phone number/email address has never been registered before, the nickname will also be displayed as a name in the student/teacher management page in the ClassIn management console.
Newly registered users will not be shown in the student/teacher management session by default, and here are two ways to add users to your school in the role of school student or school teacher.
- 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.
You are only allowed to operate teachers/students added to your school, thus the binding relationship is a required step. If you did not add users to your school based on the above guidance, you would meet request failures when scheduling classes for the users. For example, the error info returns that the user is not a teacher in your school.
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=registerMultiple
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 | The Unix Epoch timestamp is the number of seconds elapsed since 00:00:00 (world standard time) on January 1, 1970. |
userJson | Yes | Pass at least one | Bulk registered user data | There is no |
└telephone | Yes(Either pass telephone or email) | Format: 00 country number - mobile phone number; Note: 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 | For example: For US mobile phone numbers, such as 1 (800) 643-7676, please pass 001-8006437676. The Chinese mainland mobile phone number shall be passed in the format of 15800000001. |
Yes(Either pass telephone or email) | Null | Null | Null | |
┖nickname | No | The maximum length is 24 characters. If it exceeds 24 characters, it will be automatically truncated to 24 characters | NNicknames and names | If this parameter is filled in, it will be used as the name and nickname of the teacher or student. 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. The name is displayed in the ClassIn management console. |
┖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 Encrypted password | 32-bit MD5 encryption |
┖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. |
If the user is added as a student, he/she will be displayed in the student management page in the ClassIn management console. If the user is added as a teacher, he/she will be displayed in the teacher management page in the ClassIn management console. | Whether to be added as a member of the institution (teachers, students) |
└customColumn | No | 1-50 characters. It will be automatically intercepted to 50 words if it exceeds. | User - defined identity | If it is not empty, it is returned as is; if it is empty, the field is not returned. |
Response data
Key | Type | Sample Value | Meaning |
---|---|---|---|
data | array | List of registered user objects | |
└ | object | User info is returned after registration | |
└ data | number | 1283830 | Register the successful user UID |
└ telephone | string | 13800000000 | Registered mobile phone number |
└ customColumn | string | 08cbe7986a2da0975ef0e538790b9987 | Returns the custom field passed in by the user |
└ errno | number | 1 | The error code |
└ error | string | "Routine execution" | Error details |
error_info | object | Return information object | |
└ errno | number | 1 | The error code |
└ error | string | "Routine execution" | Error details |
Sample
userJson
userJson:[ {"telephone":"xxxx","nickname":"xxxx","password":"xxxx"}, {"telephone":"xxxx","nickname":"xxxx","password":"xxxx"} ]
HTTP request
POST /partner/api/course.api.php?action=registerMultiple HTTP/1.1
Host: root_url
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
SID=2339736&safeKey=5458edceccc78c6698de624e94364285&timeStamp=1493026245&userJson=[{"telephone":18516900101,"password":123456,"addToSchoolMember":1},{"telephone":18516900102,"password":123456,"addToSchoolMember":1}]
- 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 'userJson=
[ \
{\
"telephone": 18516900101,\
"password": 123456,\
"addToSchoolMember": 1\
},
{
"telephone": 18516900102,\
"password": 123456,\
"addToSchoolMember": 1\
}\
]'\
"https://root_url/partner/api/course.api.php?action=registerMultiple"
Response sample(The normal return json
packet example)
{
"data": [
{
"data": 19820374,
"telephone": "13800000000",
"errno": 1,
"error": "程序正常执行"
}
],
"error_info": {
"errno": 1,
"error": "程序正常执行"
}
}
Error Code Description
Error code | Description |
---|---|
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). |
155 | The length of the data array cannot be null. |
224 | Wrong type of uploaded image. |
288 | The mobile phone number segment is invalid. |
450 | Excution quantity exceeded limit(Up to 10 registrations at a time). |
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. |