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.
When to Use
- The request matches the skill description: This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards.
- The task needs the implementation patterns, examples, validation checks, or edge cases listed in the topic map.
- The work would benefit from the complete guidance preserved in
references/full-guidance.md.
Core Workflow
- Confirm the request matches this skill's trigger, scope, and risk profile.
- Use the topic map to identify the relevant pattern, checklist, or example before writing detailed guidance or code.
- Load
references/full-guidance.mdwhen implementation details, examples, anti-patterns, validation checks, or edge cases are needed. - Apply only the relevant guidance instead of loading or repeating the entire reference by default.
- Verify the result against any validation checks, limitations, security notes, or platform constraints in the reference.
Topic Map
- When to Use This Skill
- Core Architecture Pattern
- Step-by-Step Implementation
- Step 1: Create the External API Class File
- Step 2: Define Input Parameters
- Step 3: Implement Business Logic
- Step 4: Define Return Structure
- Step 5: Register the Service
- Step 6: Implement Error Handling & Logging
- Advanced Patterns
- Complex Database Operations
- Working with Course Modules
- Access Restrictions (Groups/Availability)
- Random Question Selection with Tags
- Testing Your API
- Via Moodle Web Services Test Client
- Via curl
- Via JavaScript (AJAX)
Reference Map
references/full-guidance.mdpreserves the complete original guidance, including examples and detailed edge cases.
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.
Progressive Loading
Keep this SKILL.md as the compact routing and workflow entrypoint. Load the reference file only when the user task requires the deeper implementation material.