Tìm kiếm tài liệu...
Mẹo tìm kiếm
Hỏi bằng tiếng Việt. AI sẽ tìm đúng nội dung trong docs cho bạn.

Tích hợp cho Xã/phường

Onboarding nhanh API chia sẻ học liệu số cho đơn vị triển khai theo scope xã/phường.


Tài liệu này dành cho partner triển khai theo nhánh xã/phường với endpoint:

  • POST /api/lms-base/learning-resources/divisions

Nếu bạn tích hợp theo nhánh khác, tham chiếu:

1. Luồng tích hợp nhanh

  1. Upload file qua POST /api/lms-base/attachments.
  2. Nhận id + path của từng file upload.
  3. Replace URL trong thumbnailUrl/contents bằng path đã upload (hoặc dùng URL ngoài hợp lệ theo rule).
  4. Gọi POST /api/lms-base/learning-resources/divisions (upsert theo doetCode + divisionCode + sourceId trong phạm vi X-Api-Key).
  5. Poll duyệt bằng GET /api/lms-base/learning-resources/divisions.

2. Rule nghiệp vụ chính

  • doetCodedivisionCode là bắt buộc cho scope xã/phường.
  • schoolCode không bắt buộc cho scope này.
  • authorPinCode, authorName, creatorPinCode, creatorName có thể để trống; hệ thống tự gán theo mã/tên xã-phường.
  • Nếu đã tồn tại bản ghi cùng doetCode + divisionCode + sourceId:
    • Đang Pending/Rejected: cập nhật (operation=updated).
    • Đang Approved: từ chối cập nhật, phải dùng sourceId mới.

3. Endpoint tra cứu và xóa

  • Theo dõi duyệt: khuyến nghị dùng webhook learning-resource.status-changed (xem Tổng quan tích hợp – mục 7.6); polling dưới đây dùng để đối soát/dự phòng.
  • Tra cứu trạng thái: GET /api/lms-base/learning-resources/divisions
    • Bắt buộc doetCodedivisionCode.
    • Không hỗ trợ lọc schoolCode.
  • Xóa pending theo lô: DELETE /api/lms-base/learning-resources/divisions
    • Request body: string[] danh sách ULID, tối đa 200 id/lần.
    • Chỉ xóa được bản ghi đang Pending.

4. Ví dụ gọi API chia sẻ (scope xã/phường)

curl --location 'https://partner.hanoi.edu.vn/api/lms-base/learning-resources/divisions' \
  --header 'X-Api-Key: <api-key-don-vi-duoc-cap>' \
  --header 'Content-Type: application/json' \
  --data '{
    "sourceId": "LR-DIV-000001",
    "title": "Chuyên đề ôn tập cuối kỳ",
    "description": "Nội dung dùng chung theo đơn vị quản lý.",
    "thumbnailUrl": "https://<cdn-or-storage>/partner-code/thumb.png",
    "authorPinCode": "",
    "authorName": "",
    "creatorPinCode": "",
    "creatorName": "",
    "fileIds": [
      "01JQ2S96MKZ8E8GHW8EXB4VPA7",
      "01JQ2SAXA9QXRVQ8S9QPA4J2AN"
    ],
    "contents": [
      {
        "name": "Video tải lên",
        "displayOrder": 1,
        "type": "VIDEO",
        "content": "https://<cdn-or-storage>/partner-code/video-division.mp4",
        "description": "Video chính"
      },
      {
        "name": "Video YouTube tham khảo",
        "displayOrder": 2,
        "type": "YOUTUBE",
        "content": "https://www.youtube.com/watch?v=d3bn7DVrZOw",
        "description": "Video tham khảo"
      }
    ],
    "gradeCode": "09",
    "subjectCode": "0201",
    "knowledgeUnitCode": "0201090100",
    "doetCode": "01",
    "divisionCode": "01234",
    "schoolCode": "",
    "yearCode": 2025,
    "educationLevelCode": "03",
    "semesterCode": 2
  }'
bash

Chi tiết toàn bộ field/rule: Tổng quan tích hợp.