Tạo nhiều tài khoản cùng lúc (Register Multiple Users)

Mục lục

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.

    1. 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)
    2. 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:

  1. 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.
  2. 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 #

KeyRequiredMore RestrictionsInstructionsDescription
SIDYesNullSchool IDIt is available through the eeo.cn application
safeKeyYesFixed 32-bit all lowercase charactersSchool authentication security keysafeKey=MD5(SECRET+timeStamp)
timeStampYesNullThe Unix Epoch timestamp should be within 20 minutes of the current API call timeThe Unix Epoch timestamp is the number of seconds elapsed since 00:00:00 (world standard time) on January 1, 1970.
userJsonYesPass at least oneBulk registered user dataThere is no
 └telephoneYes(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 registerFor 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.
 └emailYes(Either pass telephone or email)NullNullNull
 ┖nicknameNoThe maximum length is 24 characters. If it exceeds 24 characters, it will be automatically truncated to 24 charactersNNicknames and namesIf 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.
 ┖passwordYes(Either password or md5pass)NullClear-text passwordsThe 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.
 ┖md5passYes(Either password or md5pass)NullMD5 Encrypted password32-bit MD5 encryption
 ┖addToSchoolMemberNo0: 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)
 └customColumnNo1-50 characters. It will be automatically intercepted to 50 words if it exceeds.User – defined identityIf it is not empty, it is returned as is; if it is empty, the field is not returned.

Response data #

KeyTypeSample ValueMeaning
dataarrayList of registered user objects
 └objectUser info is returned after registration
  └ datanumber1283830Register the successful user UID
  └ telephonestring13800000000Registered mobile phone number
  └ customColumnstring08cbe7986a2da0975ef0e538790b9987Returns the custom field passed in by the user
  └ errnonumber1The error code
  └ errorstring“Routine execution”Error details
error_infoobjectReturn information object
 └ errnonumber1The error code
 └ errorstring“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 codeDescription
1Successful execution.
100Incomplete or incorrect parameters.
102Don’t have permissions(Security verification failed).
114Server exception.
131Registration failure.
134Illegal mobile phone number.
135The mobile phone number has been registered(UID will be returned at the same time).
137Illegal password length(6-20 digits).
155The length of the data array cannot be null.
224Wrong type of uploaded image.
288The mobile phone number segment is invalid.
450Excution quantity exceeded limit(Up to 10 registrations at a time).
461The email has been registered ( UID will be returned at the same time).
820The registration was successful, but failed to add as an institution student.
821The registration was successful, but failed to add as an institution teacher.
845Exceeded the maximum number of enabled teachers in the institution.