Add Teacher
The addTeacher interface is to bind a registered account to your institution in the teacher identity.
Notes:
- The API call requires SID, safeKey, timeStamp, teacher's mobile phone number and teacher name. The teacher avatar in binary-data format is optional.
- For mainland China mobile phone numbers, please do not pass the country calling code. Otherwise, the response prompts that it is an illegal request.
- Data in the API response is a relationship ID between the institution and the teacher. Please ignore the relationship ID and store the UID returned after implementing the register interface.
In API integration, addTeacher is an interface that you must implement. To make an API call successfully, please note that:
- The addTeacher interface is equivalent to the teacher management function in the ClassIn management console. Path: ClassIn management console-Home-Teaching-Teachers-Add Teacher. A registered user must be added to your institution first, then can be scheduled with lessons. If the user is not a teacher belonging to your institution, an error code will be returned when you call API to arrange lessons for the user.
- New users that have not registered in the ClassIn system before can be directly added to your institution when you call the register interface. Please refer to the register interface for detailed information. For registered users, the register API implementation returns error code 135. Please then call the addTeacher interface to bind the account to your institution.
URL
https://api.eeo.cn/partner/api/course.api.php?action=addTeacher
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 | imestamp used by safeKey | Unix Epoch timeStamp is the number of seconds passed by 00:00 (world standard time) on January 1, 1970 |
teacherAccount | Yes | Mobile phone number or email. Format: 00 country number - mobile phone number; note: mobile phone Numbers in mainland China do not include country .TeacherUid or teacherUid. If teacherAccount and teacherUid are passed at the same time, the teacherUid parameter shall prevail | The teacher's cell phone number | For example: fill us mobile phone number 1 (800) 643-7676 as 001-8006437676;The phone number of mainland China is 15800000001 |
teacherName | Yes | Null | Teacher's name | Null |
Filedata | No | Binary stream | Teacher's picture | Null |
Response Data
Key | Type | Sample Value | Meaning |
---|---|---|---|
data | number | 14163 | The ID of the relationship between the school and the teacher (It is needed in the edit teacher information interface) |
error_info | object | Return message object | |
└ errno | number | 1 | Error code |
└ error | string | "Normal execution" | Error details |
Sample
- HTTP Request
POST /partner/api/course.api.php?action=addTeacher HTTP/1.1
Host: root_url
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
SID=2339736&safeKey=8d3fb00ceddd29638e2d5dd12d69841d&timeStamp=1492793638&teacherAccount=001-8006437676&teacherName=hubert&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 "teacherAccount=001-8006437676" \
-d "teacherName=hubert" \
-d "Filedata=@~/photo.jpg" \
"https://api.eeo.cn/partner/api/course.api.php?action=addTeacher"
Response sample(The normal return json
packet example)
{
"data": 14161,
"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 image to server. |
104 | Operation failed (unknown error). |
113 | The mobile phone number is not registered. |
114 | Server exception. |
122 | The teacher's account is not legal. |
131 | Registration failed. |
133 | The account already exists in the institution. |
288 | The mobile phone number segment is invalid. |
400 | The requested data is not valid. |
884 | The teacher's account has been deleted by the user. |
845 | Exceeded the maximum number of enabled teachers in the institution. |