Để thêm/sửa đổi/xóa thẻ (tag) khóa học cần truyền các tham số SID, safeKey, timeStamp, courseId và danh sách khóa học. Truyền danh sách một loạt thẻ trỗng (labelIds) để xóa tất cả các thẻ khóa học.
Lưu ý: có thể thêm tối đa 10 nhãn cho một khóa học
The API call requires SID, safeKey, timeStamp, courseId and courseList. Pass an empty label array(labelIds) to delete all the course labels. When the course has no labels, pass label ID in the field of label array(labelIds) to add a label to the course. When the course label exists, pass label ID in the parameter of label array(labelIds) to modify the course label. The API call returns error info after execution.
Note: A maximum of 10 labels can be added to each course.
URL
https://api.eeo.cn/partner/api/course.api.php?action=addCourseLabels
HTTP Request Methods #
- POST
Coding Format #
- UTF-8
Request Data #
Key | Bắt buộc | Yêu cầu khác | Hướng dẫn | Mô tả |
---|---|---|---|---|
SID | Bắt buộc | — | ID của trường | Xem dữ liệu này tại Trang quản lý classin.com trong mục API |
safeKey | Bắt buộc | Fixed 32-bit all lowercase characters | Khóa bảo mật xác thực trường học | safeKey=MD5(SECRET+timeStamp) |
timeStamp | Bắt buộc | — | Theo Unix Epoch timestamp & có hiệu lực trong vòng 20 phút | Thời gian UNIX Epoch là số giây đã trôi qua kể từ 00:00:00 (giờ chuẩn quốc tế) vào ngày 1 tháng 1 năm 1970 |
CourseList | Bắt buộc | — | Danh sách khóa học | JSON format |
└ | Bắt buộc | — | Course Object | — |
└ customColumn | Không bắt buộc | — | User-defined fields. | — |
└ CourseId | Bắt buộc | — | Course ID | — |
└ labelIds | Không bắt buộc | — | label ID array | Khi mảng trống, điều đó có nghĩa là xóa tất cả các thẻ trong khóa học |
Response Parameters #
Key | Định dạng | Phản hồi | Ý nghĩa |
---|---|---|---|
data | array | [] | Return information array |
└ | object | Return information object | |
└ customColumn | string | 1 | Custom field |
└ CourseId | number | 288352 | Course ID |
└ errno | number | 1 | Error code |
└ error | string | Program normal execution | Error List |
└ | object | Return information object | |
└ customColumn | string | 1 | Custom field |
└ CourseId | number | 288352 | Course ID |
└ errno | number | 1 | Error code |
└ error | string | Program normal execution | Error List |
error_info | object | Return information array | |
└ errno | number | 1 | Error code |
└ error | string | “Program normal execution” | Error List |
Sample #
- HTTP Request
POST /partner/api/course.api.php?action=addCourseLabels HTTP/1.1
Host: www.eeo.cn
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
SID=2339736&safeKey=e98b01228fca036bf2ab060f7a8a6ec3&timeStamp=1493725870&CourseList=[{"customColumn":"1","CourseId":135120,"labelIds":[2,6,8]},{"customColumn":"2","CourseId": 135121,"labelIds": [4,7,12]}]
- 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 'CourseList=[{"customColumn":"1","CourseId":135120,"labelIds":[2,6,8]},{"customColumn":"2","CourseId":135121,"labelIds":[4,7,12]}]' \
"https://api.eeo.cn/partner/api/course.api.php?action=addCourseLabels"
Response Sample(The normal return json
packet example) #
{
"data": [
{
"customColumn": "1",
"CourseId": 288325,
"errno": 1,
"error": "程序正常执行"
},
{
"customColumn": "2",
"CourseId": 288323,
"errno": 1,
"error": "程序正常执行"
}
],
"error_info": {
"errno": 1,
"error": "程序正常执行"
}
}
Error Code Description #
Error Code | Description |
---|---|
1 | Thành công |
100 | Parameters sai định dạng hoặc không hoàn chỉnh |
102 | Không có quyền thao tác (Xác thực bảo mật thất bại) |
104 | Thao tác không thành công (lỗi không xác định) |
155 | Danh sách không được để trống |
144 | Không có khóa học này trong trường |
147 | Không có thông tin khóa học |
149 | Khóa học đã bị xóa |
358 | Một số thẻ không tồn tại hoặc đã bị xóa |
359 | Một số thẻ không tồn tại trong trường |
399 | Số lượng thẻ gắn cho khóa học đã vượt quá giới hạn tối đa |