moodle-external-api-development

Featured

Create custom external web service APIs for Moodle LMS. Use when implementing web services for course management, user tracking, quiz operations, or custom plugin functionality. Covers parameter validation, database operations, error handling, service registration, and Moodle coding standards.

API & Backend 33,961 stars 4034 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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 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 ## Core Architecture Pattern Moodle external APIs follow a strict three-method pattern: 1. **`execute_parameters()`** - Defines input parameter structure 2. **`execute()`** - Contains business logic 3. **`execute_returns()`** - Defines return structure ## Step-by-Step Implementation ### Step 1: Create the External API Class File **Location**: `/local/yourplugin/classes/external/your_api_name.php` ```php <?php namespace local_yourplugin\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 your_api_name extends external_api { // Three required methods will go here } ``` **Key Points**: - Class must extend `external_api` - Namespace follows: `local_pluginname\external` or `mod_modname\external` - Include the security check: `defined('MOODLE_INTERNAL') || die();` - Require externallib.php for base classes ### Step 2: Define Inp...

Details

Author
davila7
Repository
davila7/claude-code-templates
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category