moodle-external-api-development

Implement Moodle external APIs using the three-method pattern.

1|Updated Dec 15, 2025
One-click install
npx skills add https://github.com/jokken79/YuKyuDATA-app1.0v --skill moodle-external-api-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moodle-external-api-development
Source: https://github.com/jokken79/YuKyuDATA-app1.0v/tree/main/.agent/skills/moodle-external-api-development
Command: npx skills add https://github.com/jokken79/YuKyuDATA-app1.0v --skill moodle-external-api-development

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach for creating Moodle external web service APIs, enabling secure, standards-compliant integration with external systems while reducing boilerplate.

Core Features & Use Cases

  • Three-method pattern: execute_parameters, execute, and execute_returns to define, implement, and return API data.
  • Safety and access control: parameter validation, context checks, and capability enforcement to ensure proper permissions.
  • Service registration & consumption: guidance for registering functions, exposing REST/AJAX endpoints, and mobile service usage.
  • Best practices: error handling, logging, transactions, and coding standards for Moodle plugins.

Quick Start

Create a new external API class following the three-method pattern and register it in services.php to expose the API.

Frequently Asked Questions about moodle-external-api-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Moodle external API using the three-method pattern?

To create a Moodle external API, define the execute_parameters, execute, and execute_returns methods in your class to handle parameter validation, core logic, and return data structure. Register the function in services.php to expose the REST or AJAX endpoint.

What security checks should I implement when developing Moodle web services?

Moodle web services require parameter validation, context checks, and capability enforcement to ensure proper permissions. Secure database access, proper error handling, and access control configuration are also necessary to maintain security standards.

How do I register an external API in Moodle for external system integration?

Registering an external API in Moodle involves defining the service function in services.php to expose REST or AJAX endpoints. You must configure access control and capability rights to allow secure consumption by external systems or mobile services.

Does Moodle external API development require specific plugin coding standards?

Yes, Moodle external API development requires following specific plugin coding standards. This includes implementing proper error handling, logging, database transactions, and using the standard external_api class structure to ensure compliance.

What are common pitfalls to avoid when building Moodle external web services?

Common pitfalls when building Moodle external web services include skipping context checks, neglecting capability enforcement, improper parameter validation, and failing to handle database transactions or error logging correctly within the execute method.