Manual:Hooks/ApiCheckCanExecute

ApiCheckCanExecute
Available from version 1.20.0
Called during ApiMain::checkCanExecute().
Define function:
public static function onApiCheckCanExecute( $module, $user, &$message ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ApiCheckCanExecute": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiCheckCanExecute"
	}
}
Called from: File(s): api/ApiMain.php
Interface: ApiCheckCanExecuteHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ApiCheckCanExecute extensions.


Details

edit

Called during ApiMain::checkCanExecute(). Use to further authenticate and authorize API clients before executing the module. Return false and set a message to cancel the request.

  • $module: Module object
  • $user: Current user
  • &$message: API usage message to die with. Since 1.27, it is preferred to use an ApiMessage object here. A string or array is currently passed to ApiBase::dieUsageMsg(), but this is planned to change in 1.29.
  NODES
HOME 1
languages 2
text 2