The npm package moodlia provides the moodlia command and a Node.js client. Each plugin operation is a command with JSON output. Adaptive commands, such as course audits, use the plugin when it is available and Moodle's standard web services when it is not.
What it does
- One command per plugin operation, with built-in help and parameter checks.
- Course audit, progress, completion repair, and enrolment workflows.
- Site profiles that keep tokens in environment variables.
What you need
- Node.js 22.13 or newer.
- A Moodle site with the MoodlIA plugin and a token for it.
Installation
Install and configure
Install the command globally:
npm install -g moodliaSet the Moodle address and token (bash):
export MOODLE_BASE_URL="https://your-moodle.example" export MOODLE_REST_TOKEN="your-token"Or in PowerShell:
$env:MOODLE_BASE_URL = "https://your-moodle.example" $env:MOODLE_REST_TOKEN = "your-token"The same two values can also go in a .env file in the working folder.
First use
Start with read-only commands:
moodlia get-current-user --format json moodlia get-moodlia-status --format json moodlia get-courses --limit 10 --format jsonList every command, or the parameters of one:
moodlia --help moodlia create-module --help
Good to know
- Remote Moodle addresses must use HTTPS.
- Synchronization between sites moved to MoodlIA Sync in version 0.4.0.