Moodle Plugins directory: Api Query | Moodle.org
Api Query
Api Query allows Moodle administrators to create and manage custom SQL SELECT queries directly from the admin UI, then expose them as secure REST API endpoints callable via Moodle's standard webservice protocol.
Key features:
- Create, edit, enable/disable queries from Site Administration > Plugins > Local plugins > Api Query
- Declare typed parameters (int, text, float, bool) with required/optional flags and default values
- Built-in SQL validator: only SELECT statements are allowed; any attempt to use INSERT/UPDATE/DELETE/REPLACE/DROP/TRUNCATE/ALTER or access sensitive tables (config, sessions, external_tokens) is blocked
- Automatic handling of duplicate :placeholders in SQL
- Interactive query tester with live results from the admin UI
- Execution logs with timing and row count per call
- Full Privacy API implementation (GDPR compliant)
Designed to reduce the load on Moodle's native web services by replacing multiple individual API calls with a single optimized query per sync cycle.
Comments