Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)48k · #5251

moodle-external-api-development

Skill này làm gì

Công cụ này giúp bạn tạo các kết nối (API) mới cho Moodle, một hệ thống học trực tuyến. Nó tuân theo quy tắc và tiêu chuẩn của Moodle để mọi thứ hoạt động đúng.

Khi nào nên dùng

  • ✓Khi bạn cần thêm tính năng tùy chỉnh cho Moodle.
  • ✓Khi xây dựng ứng dụng kết nối với Moodle để quản lý khóa học.
  • ✓Khi muốn Moodle gửi thông tin đến các hệ thống khác.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/moodle-external-api-development/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/moodle-external-api-development/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm thế nào để tạo API lấy số lần làm bài kiểm tra của một học viên trong một khóa học cụ thể?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng một hướng dẫn chi tiết, giải thích từng bước để xây dựng các kết nối này. Nó đảm bảo bạn làm theo các phương pháp hay nhất và tiêu chuẩn bảo mật của Moodle.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Moodle External API Development

This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards.

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use This Skill

  • Creating custom web services for Moodle plugins
  • Implementing REST/AJAX endpoints for course management
  • Building APIs for quiz operations, user tracking, or reporting
  • Exposing Moodle functionality to external applications
  • Developing mobile app backends using Moodle

Examples from Real Implementation

Simple Read API (Get Quiz Attempts)

<?php
namespace local_userlog\external;

defined('MOODLE_INTERNAL') || die();
require_once("$CFG->libdir/externallib.php");

use external_api;
use external_function_parameters;
use external_single_structure;
use external_value;

class get_quiz_attempts extends external_api {
    public static function execute_parameters() {
        return new external_function_parameters([
            'userid' => new external_value(PARAM_INT, 'User ID'),
            'courseid' => new external_value(PARAM_INT, 'Course ID')
        ]);
    }

    public static function execute($userid, $courseid) {
        global $DB;

        self::validate_parameters(self::execute_parameters(), [
            'userid' => $userid,
            'courseid' => $courseid
        ]);

        $sql = "SELECT COUNT(*) AS quiz_attempts
                FROM {quiz_attempts} qa
                JOIN {quiz} q ON qa.quiz = q.id
                WHERE qa.userid = :userid AND q.course = :courseid";

        $attempts = $DB->get_field_sql($sql, [
            'userid' => $userid,
            'courseid' => $courseid
        ]);

        return ['quiz_attempts' => (int)$attempts];
    }

    public static function execute_returns() {
        return new external_single_structure([
            'quiz_attempts' => new external_value(PARAM_INT, 'Total number of quiz attempts')
        ]);
    }
}

Complex Write API (Create Quiz from Categories)

See attached create_quiz_from_categories.php for a comprehensive example including:

  • Multiple database insertions
  • Course module creation
  • Quiz instance configuration
  • Random question selection with tags
  • Group-based access restrictions
  • Extensive error logging
  • Transaction management

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Câu hỏi thường gặp

API bên ngoài là gì?

Đó là cách để các chương trình khác nhau nói chuyện với nhau. Với Moodle, nó cho phép các hệ thống khác yêu cầu hoặc gửi thông tin đến Moodle.

Tôi có cần là lập trình viên giỏi để dùng công cụ này không?

Bạn nên có chút kiến thức lập trình cơ bản vì công cụ liên quan đến việc viết mã. Hướng dẫn chi tiết sẽ giúp bạn hiểu từng bước.

Tiêu chuẩn viết mã của Moodle là gì?

Đó là các quy tắc mà lập trình viên Moodle tuân theo để viết mã có tổ chức, an toàn và dễ hiểu cho các lập trình viên khác.

Chi tiết

Mô tả gốc của tác giả

This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5251
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự