Tạo/sửa/xóa tag khóa học

Mục lục

Để 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 #

KeyBắt buộcYêu cầu khácHướng dẫnMô tả
SIDBắt buộcID của trườngXem dữ liệu này tại Trang quản lý classin.com trong mục API
safeKeyBắt buộcFixed 32-bit all lowercase charactersKhóa bảo mật xác thực trường họcsafeKey=MD5(SECRET+timeStamp)
timeStampBắt buộcTheo Unix Epoch timestamp & có hiệu lực trong vòng 20 phútThờ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
CourseListBắt buộcDanh sách khóa họcJSON format
 └Bắt buộcCourse Object
  └ customColumnKhông bắt buộcUser-defined fields.
  └ CourseIdBắt buộcCourse ID
  └ labelIdsKhông bắt buộclabel ID arrayKhi 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ạngPhản hồiÝ nghĩa
dataarray[]Return information array
 └object Return information object
  └ customColumnstring1Custom field
  └ CourseIdnumber288352Course ID
  └ errnonumber1Error code
  └ errorstringProgram normal executionError List
 └object Return information object
  └ customColumnstring1Custom field
  └ CourseIdnumber288352Course ID
  └ errnonumber1Error code
  └ errorstringProgram normal executionError List
error_infoobject Return information array
 └ errnonumber1Error code
 └ errorstring“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 CodeDescription
1Thành công
100Parameters sai định dạng hoặc không hoàn chỉnh
102Không có quyền thao tác (Xác thực bảo mật thất bại)
104Thao tác không thành công (lỗi không xác định)
155Danh sách không được để trống
144Không có khóa học này trong trường
147Không có thông tin khóa học
149Khóa học đã bị xóa
358Một số thẻ không tồn tại hoặc đã bị xóa
359Mộ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