Jump to: navigation, search

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎日本語 • ‎polski • ‎português • ‎português do Brasil
Extensions: $wgAPIModules
API module extensions.
Introduced in version: 1.11.0 (r25364)
Removed in version: still in use
Allowed values: (array)
Default value: array()
Other settings: Alphabetical | By function

Details[edit | edit source]

Associative array mapping module name to class name. Extension modules may override the core modules (which are initialized in ApiMain.phpManual:ApiMain.php).

Example[edit | edit source]

Suppose you wanted to create an API module to calibrate the wiki's awesomeness level. You would write a new extension, CalibrateAwesomeness, putting the following in your CalibrateAwesomeness.php file:

$wgAutoloadClasses['ApiCalibrateAwesomeness'] = __DIR__ . 'ApiCalibrateAwesomeness.php';
$wgAPIModules['calibrateawesomeness'] = 'ApiCalibrateAwesomeness';

Then you would create an ApiCalibrateAwesomeness.php file containing an ApiCalibrateAwesomeness class that extends, say, ApiBaseManual:ApiBase.php, e.g.

class ApiCalibrateAwesomeness extends ApiBase {
	public function execute() {

	public function getAllowedParams() {
		return array(
			'level' => array (
				ApiBase::PARAM_TYPE => 'integer',
				ApiBase::PARAM_REQUIRED => true

After installing your new extension on the English Wikipedia, you could then access that module by using, e.g.,